Class: Datamappify::Data::Criteria::Sequel::Save

Inherits:
Relational::Save show all
Includes:
Concerns::UpdatePrimaryRecord
Defined in:
lib/datamappify/data/criteria/sequel/save.rb

Direct Known Subclasses

SaveByKey

Instance Attribute Summary

Attributes inherited from Common

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

Instance Method Summary collapse

Methods included from Concerns::UpdatePrimaryRecord

#update_primary_record_with

Methods inherited from Relational::Save

#create_record, #perform, #update_entity_with

Methods inherited from Common

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

Constructor Details

This class inherits a constructor from Datamappify::Data::Criteria::Common

Instance Method Details

#save(record) ⇒ Object (private)



18
19
20
21
22
# File 'lib/datamappify/data/criteria/sequel/save.rb', line 18

def save(record)
  record.update attributes_and_values

  super
end

#save_recordObject (private)



13
14
15
16
# File 'lib/datamappify/data/criteria/sequel/save.rb', line 13

def save_record
  record = source_class.find(criteria) || source_class.new(criteria)
  save(record)
end