Last active
December 2, 2018 09:51
-
-
Save gardwired/45d99f4de0e35354105251554f615cf6 to your computer and use it in GitHub Desktop.
temporarily disable delayed_paperclip
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
# this could be wrapped in a block that temporarily disrupts alias chain | |
# then sets it back. i post this here just to show the relevant hooks that | |
# you'd need to touch in whatever solution if you needed it to be more dynamic. | |
Paperclip::Attachment.class_eval do | |
alias_method :post_processing, :post_processing_without_delay | |
alias_method :post_processing=, :post_processing_without_delay= | |
alias_method :save, :save_without_prepare_enqueueing | |
end | |
# fyi: skip_callbacks may not be threadsafe in rails 4 anyway: | |
# https://stackoverflow.com/questions/19449019/rails-4-skip-callback/19449714 | |
ActiveRecord::Base.class_eval do | |
skip_callback :commit, :after, :enqueue_delayed_processing | |
skip_callback :save, :after, :enqueue_delayed_processing | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment