Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delayed jobs not working on module methods #19

Open
radiospiel opened this issue Dec 30, 2009 · 2 comments
Open

Delayed jobs not working on module methods #19

radiospiel opened this issue Dec 30, 2009 · 2 comments

Comments

@radiospiel
Copy link

I find it a bit strange that

class X
def self.method; end
end

X.send_later :method

works, but

module X
def self.method; end
end

X.send_later :method

fails. Is there any philosophical reason for this? If not, I would like to see the latter working as well. Besides, it would be great if send_later methods that will fail because the target object cannot be serialized would raise an ArgmentError.

@tobi
Copy link
Owner

tobi commented Dec 31, 2009

I'd accept a patch to make this work. It's probably a oneliner.

@radiospiel
Copy link
Author

Thanks. The following should do:

--- a/vendor/plugins/delayed_job/lib/delayed/performable_method.rb
+++ b/vendor/plugins/delayed_job/lib/delayed/performable_method.rb
@@ -38,7 +38,7 @@ module Delayed

     def dump(arg)
       case arg
-      when Class              then class_to_string(arg)
+      when Module             then class_to_string(arg)
       when ActiveRecord::Base then ar_to_string(arg)
       else arg
       end

but the naming is suboptimal, of course. I will try to prepare a better patch during the next days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants