Module: Paperclip::CallbackCompatability::Rails21::Running

Defined in:
lib/paperclip/callback_compatability.rb

Instance Method Summary collapse

Instance Method Details

#run_paperclip_callbacks(callback, opts = nil, &blk) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/paperclip/callback_compatability.rb', line 19

def run_paperclip_callbacks(callback, opts = nil, &blk)
  # The overall structure of this isn't ideal since after callbacks run even if
  # befores return false. But this is how rails 3's callbacks work, unfortunately.
  if run_callbacks(:"before_#{callback}"){ |result, object| result == false } != false
    blk.call
  end
  run_callbacks(:"after_#{callback}"){ |result, object| result == false }
end