module PgORM::Persistence
Direct including types
Defined in:
pg-orm/persistence.crInstance Method Summary
-
#delete
Only deletes record from table.
-
#destroy
Destroy object, run destroy callbacks and update associations
- #destroyed=(destroyed : Bool)
- #destroyed? : Bool
- #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
PgORM::Error::RecordNotSaved
if record was not previously persistedPgORM::Error::RecordNotFound
if record 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
PgORM::Error:RecordNotSaved
if was record was destroyed before savePgORM::Error:RecordNotSaved
if was record was not saved by DBPgORM::Error:RecordInvalid
on validation failures
def update(**attributes)
#
Updates the model
Non-atomic updates are required for multirecord updates
def update!(**attributes)
#
Updates the model in place
Raises PgORM::Error::RecordInvalid
on update failure