module Datamappify::Data::Criteria::Concerns::UpdatePrimaryRecord
Private Instance Methods
save(record)
click to toggle source
# File lib/datamappify/data/criteria/concerns/update_primary_record.rb, line 8 def save(record) if options && options[:via] && options[:primary_record] update_primary_record_with(record) end record end
update_primary_record_with(record)
click to toggle source
# File lib/datamappify/data/criteria/concerns/update_primary_record.rb, line 16 def update_primary_record_with(record) save = self.class.superclass.new(options[:primary_record].class, entity, { :id => options[:primary_record].id }) save.attributes_and_values = { options[:via] => record.id } save.send(:save_record) end