Method: DataMapper::Associations::Relationship#child_key
- Defined in:
- lib/dm-core/associations/relationship.rb
#child_key ⇒ PropertySet Also known as: relationship_child_key
Returns a set of keys that identify the target model
195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/dm-core/associations/relationship.rb', line 195 def child_key return @child_key if defined?(@child_key) repository_name = child_repository_name || parent_repository_name properties = child_model.properties(repository_name) @child_key = if @child_properties child_key = properties.values_at(*@child_properties) properties.class.new(child_key).freeze else properties.key end end |