Module: Paperclip::Callbacks::Defining

Defined in:
lib/paperclip/callbacks.rb

Instance Method Summary collapse

Instance Method Details

#define_paperclip_callbacks(*callbacks) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/paperclip/callbacks.rb', line 9

def define_paperclip_callbacks(*callbacks)
  define_callbacks(*[callbacks, {:terminator => callback_terminator}].flatten)
  callbacks.each do |callback|
    eval "def before_\#{callback}(*args, &blk)\nset_callback(:\#{callback}, :before, *args, &blk)\nend\ndef after_\#{callback}(*args, &blk)\nset_callback(:\#{callback}, :after, *args, &blk)\nend\n"
  end
end