Module: StoreModel::NestedAttributes::ClassMethods
- Defined in:
- lib/store_model/nested_attributes.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#accepts_nested_attributes_for(*associations) ⇒ Object
Enables handling of nested StoreModel::Model attributes.
Instance Method Details
#accepts_nested_attributes_for(*associations) ⇒ Object
Enables handling of nested StoreModel::Model attributes
Supported options:
- :allow_destroy
-
If true, destroys any members from the attributes hash with a
_destroy
key and a value that evaluates totrue
(e.g. 1, ‘1’, true, or ‘true’). This option is off by default.
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/store_model/nested_attributes.rb', line 21 def accepts_nested_attributes_for(*associations) associations.each do |association, | case attribute_types[association.to_s] when Types::One define_association_setter_for_single(association, ) alias_method "#{association}_attributes=", "#{association}=" when Types::Many define_association_setter_for_many(association, ) end define_attr_accessor_for_destroy(association, ) end end |