Module: MongoMapper::Plugins::Associations::NestedAttributes::ClassMethods
- Defined in:
- lib/mm-nested-attrs.rb
Instance Method Summary collapse
Instance Method Details
#accepts_nested_attributes_for(*attr_names) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/mm-nested-attrs.rb', line 8 def accepts_nested_attributes_for(*attr_names) = { :allow_destroy => false } .update(attr_names.) .assert_valid_keys(:allow_destroy, :reject_if) for association_name in attr_names module_eval %{ def #{association_name}_attributes=(attributes) assign_nested_attributes_for_association(:#{association_name}, attributes, #{options[:allow_destroy]}) end }, __FILE__, __LINE__ end end |