Delayed jobs not working on module methods #19

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

Comments

Projects
None yet
2 participants

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.

Owner

tobi commented Dec 31, 2009

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

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