module PgORM::Persistence

Direct including types

Defined in:

pg-orm/persistence.cr

Instance Method Summary

Instance Method Detail

def delete #

Only deletes record from table. No callbacks or updated associations


[View source]
def destroy #

Destroy object, run destroy callbacks and update associations


[View source]
def destroyed=(destroyed : Bool) #

[View source]
def destroyed? : Bool #

[View source]
def new_record? : Bool #

[View source]
def persisted? #

[View source]
def reload! #

Reload the model in place.

Raises


[View source]
def save(**options) #

Saves the model.

If the model is new, a record gets created in the database, otherwise the existing record gets updated.


[View source]
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 save
  • PgORM::Error:RecordNotSaved if was record was not saved by DB
  • PgORM::Error:RecordInvalid on validation failures

[View source]
def update(**attributes) #

Updates the model

Non-atomic updates are required for multirecord updates


[View source]
def update!(**attributes) #

Updates the model in place

Raises PgORM::Error::RecordInvalid on update failure


[View source]
def update_fields(**attributes) #

Atomically update specified fields, without running callbacks


[View source]