Last active
August 29, 2015 14:03
-
-
Save trmcnvn/05a282cefa2c171a6e1d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/jrgifford/delayed_paperclip/blob/master/lib/delayed_paperclip/attachment.rb#L94 | |
# delayed_paperclip uses ActiveRecord::Relation#update_all which does not invoke | |
# ActiveRecord callbacks such as after_save, this patch changes the update method | |
# to use ActiveRecord::Relation#update | |
module DelayedPaperclip | |
module Attachment | |
module InstanceMethods | |
private | |
def update_processing_column | |
if instance.respond_to?(:"#{name}_processing?") | |
instance.send("#{name}_processing=", false) | |
instance.class.update(instance.id, { "#{name}_processing" => false }) | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment