couchrest_model/lib/couchrest/model/callbacks.rb
2011-06-09 01:05:22 +02:00

29 lines
711 B
Ruby

# encoding: utf-8
module CouchRest #:nodoc:
module Model #:nodoc:
module Callbacks
extend ActiveSupport::Concern
CALLBACKS = [
:before_validation, :after_validation,
:after_initialize,
:before_create, :around_create, :after_create,
:before_destroy, :around_destroy, :after_destroy,
:before_save, :around_save, :after_save,
:before_update, :around_update, :after_update,
]
included do
extend ActiveModel::Callbacks
include ActiveModel::Validations::Callbacks
define_model_callbacks :initialize, :only => :after
define_model_callbacks :create, :destroy, :save, :update
end
end
end
end