module Cequel::Record::Callbacks

Cequel::Record models provide lifecycle callbacks for `create`, `update`, `save`, `destroy`, and `validation`.

@example

class User
  include Cequel::Record

  key :login, :text
  column :name, :text

  after_create :send_welcome_email
  after_update :reindex_posts_for_search
  after_save :reindex_for_search
  after_destroy :send_farewell_email
  before_validation :set_permalink
end

@since 0.1.0

Public Instance Methods

destroy(options = {}) click to toggle source

(see Persistence#destroy)

Calls superclass method
# File lib/cequel/record/callbacks.rb, line 39
def destroy(options = {})
  connection.batch(options.slice(:consistency)) do
    run_callbacks(:destroy) { super }
  end
end
save(options = {}) click to toggle source

(see Persistence#save)

Calls superclass method
# File lib/cequel/record/callbacks.rb, line 32
def save(options = {})
  connection.batch(options.slice(:consistency)) do
    run_callbacks(:save) { super }
  end
end

Protected Instance Methods

create(*) click to toggle source
Calls superclass method
# File lib/cequel/record/callbacks.rb, line 47
def create(*)
  run_callbacks(:create) { super }
end
update(*) click to toggle source
Calls superclass method
# File lib/cequel/record/callbacks.rb, line 51
def update(*)
  run_callbacks(:update) { super }
end