Class: Para::AttributeField::NestedManyField
- Inherits:
-
HasManyField
- Object
- Base
- RelationField
- HasManyField
- Para::AttributeField::NestedManyField
- Defined in:
- lib/para/attribute_field/nested_many.rb
Instance Attribute Summary
Attributes inherited from Base
#field_method, #field_type, #model, #name, #type
Instance Method Summary collapse
Methods inherited from HasManyField
#field_name, #plural_foreign_key, #value_for
Methods inherited from Base
#attribute_column_path, #determine_name_and_field_method!, #field_name, field_option, #field_options, field_types, #initialize, register, #type?, #value_for
Constructor Details
This class inherits a constructor from Para::AttributeField::Base
Instance Method Details
#nested_attributes_key ⇒ Object
24 25 26 |
# File 'lib/para/attribute_field/nested_many.rb', line 24 def nested_attributes_key @nested_attributes_key ||= :"#{ name }_attributes" end |
#nested_model_mappings ⇒ Object
20 21 22 |
# File 'lib/para/attribute_field/nested_many.rb', line 20 def nested_model_mappings @nested_model_mappings ||= AttributeFieldMappings.new(reflection.klass) end |
#parse_input(params) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/para/attribute_field/nested_many.rb', line 6 def parse_input(params) if (nested_attributes = params[nested_attributes_key]) nested_attributes.each do |index, attributes| nested_model_mappings.fields.each do |field| field.parse_input(attributes) end params[nested_attributes_key][index] = attributes end else super(params) end end |