2010-06-20 22:01:11 +02:00
|
|
|
# encoding: utf-8
|
|
|
|
|
|
|
|
module CouchRest #:nodoc:
|
|
|
|
module Model #:nodoc:
|
|
|
|
|
|
|
|
module Callbacks
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
2011-06-09 01:05:22 +02:00
|
|
|
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,
|
|
|
|
]
|
2010-06-20 22:01:11 +02:00
|
|
|
|
2011-06-09 01:05:22 +02:00
|
|
|
included do
|
|
|
|
extend ActiveModel::Callbacks
|
|
|
|
include ActiveModel::Validations::Callbacks
|
2010-06-20 22:01:11 +02:00
|
|
|
|
2011-06-09 01:05:22 +02:00
|
|
|
define_model_callbacks :initialize, :only => :after
|
|
|
|
define_model_callbacks :create, :destroy, :save, :update
|
2010-06-20 22:01:11 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|