Class: Datamappify::Data::Criteria::Relational::FindByKey

Inherits:
Find
  • Object
show all
Includes:
Concerns::SetCriteria
Defined in:
lib/datamappify/data/criteria/relational/find_by_key.rb

Direct Known Subclasses

ActiveRecord::FindByKey, Sequel::FindByKey

Instance Attribute Summary

Attributes inherited from Common

#attributes, #attributes_and_values, #criteria, #entity, #options, #source_class

Instance Method Summary collapse

Methods included from Concerns::SetCriteria

#criteria_for_normal_mapping, #set_criteria

Methods inherited from Find

#perform, #update_entity_with

Methods inherited from Common

#any_attribute, #default_source_class_name, #ignore?, #ignore_attribute?, #key_name, #key_value, #new_record?, #perform_with_callbacks, #pk, #primary_record?, #store_attribute_value

Constructor Details

#initialize(source_class, entity, attributes, options = {}, &block) ⇒ FindByKey

Returns a new instance of FindByKey.



11
12
13
# File 'lib/datamappify/data/criteria/relational/find_by_key.rb', line 11

def initialize(source_class, entity, attributes, options = {}, &block)
  super(source_class, entity, nil, attributes, options, &block)
end

Instance Method Details

#criteria_for_reverse_mappingObject (private)



17
18
19
20
# File 'lib/datamappify/data/criteria/relational/find_by_key.rb', line 17

def criteria_for_reverse_mapping
  reverse_id = options[:primary_record].send(options[:via])
  reverse_id ? { :id => reverse_id } : {}
end