Module: RailsFormBuilderParamName::FieldParamNameHelper

Defined in:
lib/rails_form_builder_param_name/field_param_name_helper.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#field_param_name(object_name, method, options = {}) ⇒ Object

Returns the parameter name that Rails form helpers will generate for a given method. For example:

<div data-birth-date-field="<%= field_param_name :user, :birth_date %>"></div>

will render a div with the data attribute “data-birth-date-field” set to the string “user”. This can be useful for passing the correct field names to JavaScript frameworks to send back in a hybrid response.



14
15
16
# File 'lib/rails_form_builder_param_name/field_param_name_helper.rb', line 14

def field_param_name(object_name, method, options = {})
  RailsFormBuilderParamName::FieldParamNameTag.new(object_name, method, self).field_param_name(options[:multiple])
end