Module: Hammock::Callbacks

Defined in:
lib/hammock/callbacks.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object

:nodoc:



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/hammock/callbacks.rb', line 4

def self.included base # :nodoc:
  base.send :include, InstanceMethods
  base.send :extend, ClassMethods

  base.class_eval {
    include ActiveSupport::Callbacks

    define_hammock_callbacks *%w[
      before_find       during_find     after_find
                                        after_failed_find
                                        after_find_on_create
                                        after_failed_find_on_create

      before_index      before_show
      before_modify     before_new      before_edit

      before_save       after_save      after_failed_save
      before_create     after_create    after_failed_create
      before_update     after_update    after_failed_update
      before_destroy    after_destroy
      before_undestroy  after_undestroy

      before_suggest    after_suggest
    ]
  }
end