Module: DataMapper::Adapters::YamlAdapterAdjust
- Defined in:
- lib/dm-adjust/adapters/yaml_adapter.rb
Instance Method Summary collapse
Instance Method Details
#adjust(attributes, collection) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/dm-adjust/adapters/yaml_adapter.rb', line 4 def adjust(attributes, collection) attributes = attributes_as_fields(attributes) update_records(collection.model) do |records| records_to_update = collection.query.filter_records(records.dup) records_to_update.each do |record| record.update(attributes) do |key, oldvalue, newvalue| (oldvalue || 0) + newvalue end end.size end end |