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 = parent_key.zip(@child_properties || []).map do |parent_property, property_name|
property_name ||= "#{name}_#{parent_property.name}".to_sym
properties[property_name] || begin
DataMapper.repository(repository_name) do
type = parent_property.send(parent_property.type == DataMapper::Types::Boolean ? :type : :primitive)
child_model.property(property_name, type, child_key_options(parent_property))
end
end
end
@child_key = properties.class.new(child_key).freeze
end