Method: DataMapper::Adapters::InMemoryAdapter#update
- Defined in:
- lib/dm-core/adapters/in_memory_adapter.rb
#update(attributes, collection) ⇒ Object
Used by DataMapper to update the attributes on existing records in a data-store: “UPDATE” in SQL-speak. It takes a hash of the attributes to update with, as well as a collection object that specifies which resources should be updated.
56 57 58 59 |
# File 'lib/dm-core/adapters/in_memory_adapter.rb', line 56 def update(attributes, collection) attributes = attributes_as_fields(attributes) read(collection.query).each { |record| record.update(attributes) }.size end |