Skip to content

Instantly share code, notes, and snippets.

@gardwired
Last active December 2, 2018 09:51
Show Gist options
  • Save gardwired/45d99f4de0e35354105251554f615cf6 to your computer and use it in GitHub Desktop.
Save gardwired/45d99f4de0e35354105251554f615cf6 to your computer and use it in GitHub Desktop.
temporarily disable delayed_paperclip
# 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