module RethinkORM::Persistence
Direct including types
Defined in:
rethinkdb-orm/persistence.crInstance Method Summary
- #_new_flag
- #_new_flag=(_new_flag)
-
#delete
Only deletes document from table.
-
#destroy
Destroy object, run destroy callbacks and update associations
- #destroyed=(destroyed : Bool)
- #destroyed? : Bool
-
#new_record?
Id generated on save or set on load
- #persisted?
-
#reload!
Reload the model in place.
-
#save(**options)
Saves the model.
-
#save!(**options)
Saves the model.
-
#update(**attributes)
Updates the model
-
#update!(**attributes)
Updates the model in place
-
#update_fields(**attributes)
Atomically update specified fields, without running callbacks
Instance Method Detail
def reload!
#
Reload the model in place.
Raises
RethinkORM::Error::DocumentNotSaved
if document was not previously persistedRethinkORM::Error::DocumentNotFound
if document fails to load
def save(**options)
#
Saves the model.
If the model is new, a record gets created in the database, otherwise the existing record gets updated.
def save!(**options)
#
Saves the model.
If the model is new, a record gets created in the database, otherwise the existing record gets updated.
Raises
RethinkORM::Error:DocumentNotSaved
if was document was destroyed before saveRethinkORM::Error:DocumentNotSaved
if was document was not saved by RethinkDBRethinkORM::Error:DocumentInvalid
on validation failures
def update(**attributes)
#
Updates the model
Non-atomic updates are required for multidocument updates
def update!(**attributes)
#
Updates the model in place
Raises RethinkORM::Error::DocumentInvalid
on update failure