Module: DataMapper::NestedAttributes::Relationship

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

Overview

Extensions for Associations::Relationship.

Instance Method Summary collapse

Instance Method Details

#extract_keys_for_nested_attributes(model, attributes) ⇒ Array

Extracts the primary key values necessary to retrieve or update a nested model when using Model#accepts_nested_attributes_for. Values are taken from the specified model and attribute hash with the former having priority. Values for properties in the primary key that are not included in the foreign key must be specified in the attributes hash.

Parameters:

  • model (DataMapper::Model)

    The model that accepts nested attributes.

  • attributes (Hash)

    The attributes assigned to the nested attribute setter on the model.

Returns:

  • (Array)

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/dm-accepts_nested_attributes/relationship.rb', line 20

def extract_keys_for_nested_attributes(model, attributes)
  raise NotImplementedError, "extract_keys must be overridden in a derived class"
end