19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/reactive_record/active_record/reactive_record/reactive_set_relationship_helpers.rb', line 19
def update_mapped_attributes(aggregation)
attr = aggregation.attribute
attributes[attr] ||= aggregation.klass.new if new?
aggregate_record = attributes[attr]
raise 'uninitialized aggregate attribute - should never happen' unless aggregate_record
aggregate_backing_record = aggregate_record.backing_record
aggregate_backing_record.virgin = false
aggregation.mapped_attributes.each do |mapped_attribute|
aggregate_backing_record.update_attribute(mapped_attribute, yield(mapped_attribute))
end
end
|