Method: SimpleRecord::ActiveSdb::Base#save_attributes
- Defined in:
- lib/simple_record/active_sdb.rb
#save_attributes(attrs) ⇒ Object
Replaces the attributes at SDB by the given values. Attrs is a hash: { attribute1 => values1, …, attributeN => valuesN }. The other in-memory attributes are not being saved. Returns a hash of stored attributes.
see save method
897 898 899 900 901 902 903 904 905 906 907 908 909 910 |
# File 'lib/simple_record/active_sdb.rb', line 897 def save_attributes(attrs) prepare_for_update attrs = uniq_values(attrs) # if 'id' is present in attrs hash then replace internal 'id' attribute unless attrs['id'].blank? @attributes['id'] = attrs['id'] else attrs['id'] = id end connection.put_attributes(domain, id, attrs, :replace) unless attrs.blank? attrs.each { |attribute, values| attrs[attribute] = values } mark_as_old attrs end |