Method: CouchbaseOrm::Persistence#reload
- Defined in:
- lib/couchbase-orm/persistence.rb
#reload ⇒ Object
Reloads the record from the database.
This method finds record by its key and modifies the receiver in-place:
211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/couchbase-orm/persistence.rb', line 211 def reload raise "unable to reload, model not persisted" unless id CouchbaseOrm.logger.debug "Data - Get #{id}" resp = self.class.collection.get!(id) assign_attributes(decode_encrypted_attributes(resp.content.except("id", *self.class.ignored_properties ))) # API return a nil id @__metadata__.cas = resp.cas reset_associations clear_changes_information reset_object! self end |