Module: DataMapper::NestedAttributes::ManyToMany

Defined in:
lib/dm-accepts_nested_attributes/relationship.rb

Overview

Extensions for Associations::ManyToMany::Relationship.

Instance Method Summary collapse

Instance Method Details

#extract_keys_for_nested_attributes(model, attributes) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/dm-accepts_nested_attributes/relationship.rb', line 27

def extract_keys_for_nested_attributes(model, attributes)
  keys = self.child_key.map do |key|
    attributes[key.name]
  end

  keys.any? { |key| DataMapper::Ext.blank?(key) } ? nil : keys
end