class Datamappify::Data::Criteria::Relational::Find

Public Instance Methods

perform() click to toggle source
# File lib/datamappify/data/criteria/relational/find.rb, line 6
def perform
  record = source_class.where(criteria).first

  update_entity_with(record) if record

  record
end

Private Instance Methods

update_entity_with(record) click to toggle source
# File lib/datamappify/data/criteria/relational/find.rb, line 16
def update_entity_with(record)
  attributes.each do |attribute|
    entity.send("#{attribute.name}=", record.send(attribute.source_attribute_name))
  end
end