Created
August 31, 2010 04:59
-
-
Save arzumy/558576 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
# Cheapskate solution so that delayed_job only kicks off in production | |
# Useful when you can't pass the development delayed_job in heroku cost to client | |
Delayed::DelayProxy.class_eval do | |
def method_missing(method, *args) | |
performable = Delayed::PerformableMethod.new(@target, method.to_sym, args) | |
if RAILS_ENV == "production" | |
Delayed::Job.create({ | |
:payload_object => performable, | |
:priority => ::Delayed::Worker.default_priority | |
}.merge(@options)) | |
else | |
performable.perform | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment