Module: Paperclip::CallbackCompatability::ClassMethods

Defined in:
lib/paperclip/callback_compatability.rb

Instance Method Summary collapse

Instance Method Details

#define_callbacks(*args) ⇒ Object

The implementation of this method is taken from the Rails 1.2.6 source, from rails/activerecord/lib/active_record/callbacks.rb, line 192.



13
14
15
16
17
18
19
20
21
22
# File 'lib/paperclip/callback_compatability.rb', line 13

def define_callbacks(*args)
  args.each do |method|
    self.class_eval <<-"end_eval"
      def self.#{method}(*callbacks, &block)
        callbacks << block if block_given?
        write_inheritable_array(#{method.to_sym.inspect}, callbacks)
      end
    end_eval
  end
end