Module: CouchPotato::Persistence::Callbacks
- Defined in:
- lib/couch_potato/persistence/callbacks.rb
Class Method Summary collapse
-
.included(base) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#run_callbacks(name, &block) ⇒ Object
Runs all callbacks on a model with the given name, e.g.
Class Method Details
.included(base) ⇒ Object
:nodoc:
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/couch_potato/persistence/callbacks.rb', line 4 def self.included(base) #:nodoc: # base.class_eval do # attr_accessor :skip_callbacks # # define_model_callbacks :create, :save, :update, :destroy # define_model_callbacks *[:save, :create, :update].map {|c| :"validation_on_#{c}"} # define_model_callbacks :validation # end end |
Instance Method Details
#run_callbacks(name, &block) ⇒ Object
Runs all callbacks on a model with the given name, e.g. :after_create.
This method is called by the CouchPotato::Database object when saving/destroying an object
18 19 20 21 22 |
# File 'lib/couch_potato/persistence/callbacks.rb', line 18 def run_callbacks(name, &block) # return if skip_callbacks # # send(:"_run_#{name}_callbacks", &block) end |