Module: ActiveData::ActiveRecord::NestedAttributes::ClassMethods

Defined in:
lib/active_data/active_record/nested_attributes.rb

Instance Method Summary collapse

Instance Method Details

#accepts_nested_attributes_for_with_active_data(*attr_names) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/active_data/active_record/nested_attributes.rb', line 11

def accepts_nested_attributes_for_with_active_data *attr_names
  options = attr_names.extract_options!
  active_data_associations, active_record_association = attr_names.partition do |association_name|
    reflect_on_association(association_name).is_a?(ActiveData::Model::Associations::Reflections::Base)
  end

  ActiveData::Model::Associations::NestedAttributes::NestedAttributesMethods
    .accepts_nested_attributes_for self, *active_data_associations, options.dup
  accepts_nested_attributes_for_without_active_data *active_record_association, options.dup
end