Module: Paperclip::CallbackCompatability::Rails3::Defining

Defined in:
lib/paperclip/callback_compatability.rb

Instance Method Summary collapse

Instance Method Details

#define_paperclip_callbacks(*callbacks) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/paperclip/callback_compatability.rb', line 37

def define_paperclip_callbacks(*callbacks)
  define_callbacks *[callbacks, {:terminator => "result == false"}].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