Module: Cequel::Record::Callbacks
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/cequel/record/callbacks.rb
Overview
Cequel::Record models provide lifecycle callbacks for ‘create`, `update`, `save`, `destroy`, and `validation`.
Instance Method Summary collapse
-
#destroy(options = {}) ⇒ Record
Remove this record from the database.
-
#save(options = {}) ⇒ Boolean
Persist the record to the database.
Instance Method Details
#destroy(options = {}) ⇒ Record
Remove this record from the database
40 41 42 43 44 |
# File 'lib/cequel/record/callbacks.rb', line 40 def destroy( = {}) connection.batch(.slice(:consistency)) do run_callbacks(:destroy) { super } end end |
#save(options = {}) ⇒ Boolean
Persist the record to the database. If this is a new record, it will be saved using an INSERT statement. If it is an existing record, it will be persisted using a series of ‘UPDATE` and `DELETE` statements which will persist all changes to the database, including atomic collection modifications.
33 34 35 36 37 |
# File 'lib/cequel/record/callbacks.rb', line 33 def save( = {}) connection.batch(.slice(:consistency)) do run_callbacks(:save) { super } end end |