Skip to content

Instantly share code, notes, and snippets.

@trmcnvn
Last active August 29, 2015 14:03
Show Gist options
  • Save trmcnvn/05a282cefa2c171a6e1d to your computer and use it in GitHub Desktop.
Save trmcnvn/05a282cefa2c171a6e1d to your computer and use it in GitHub Desktop.
# 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