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 <<-end_callbacks
      def before_#{callback}(*args, &blk)
        set_callback(:#{callback}, :before, *args, &blk)
      end
      def after_#{callback}(*args, &blk)
        set_callback(:#{callback}, :after, *args, &blk)
      end
    end_callbacks
  end
end