Method: DynamicFieldsets::Field#form_partial_locals

Defined in:
app/models/dynamic_fieldsets/field.rb

#form_partial_locals(args) ⇒ Hash

Returns Data needed for the form partial.

Returns:

  • Data needed for the form partial



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'app/models/dynamic_fieldsets/field.rb', line 88

def form_partial_locals(args)
  output = {
    :fsa => args[:fsa],
    :fieldset_child => args[:fieldset_child],
    :attrs => self.html_attribute_hash,
    # for use in helpers like text_field and date_select
    :object => "#{DynamicFieldsets::config.form_fieldset_associator_prefix}#{args[:fsa].id}",
    :method => "#{DynamicFieldsets::config.form_field_prefix}#{args[:fieldset_child].id}",
  }
  # name for use in helpers like select_tag, check_box_tag, or anything ending with _tag
  # this is more of a convenience method
  output[:name] = "#{output[:object]}[#{output[:method]}]"
  output[:id] = "#{output[:object]}_#{output[:method]}"
  return output
end