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

NoMethodError (undefined method `key?' for #<JSON::Ext::Generator::State:0x007........ #10

Open
twiduch opened this issue Oct 3, 2013 · 5 comments

Comments

@twiduch
Copy link

twiduch commented Oct 3, 2013

I am getting that error when trying with sidekiq_mailer 0.0.6

@scottkf
Copy link

scottkf commented Oct 29, 2013

@twiduch This is a probably when using this with devise, because devise passes in the User or whichever model and not a user's attributes, don't know the fix yet

@chadwtaylor
Copy link

+1 I'm getting the same error. This happened after upgrading from Rails 3.2 to 4.0.

@keo64
Copy link

keo64 commented Jun 11, 2014

I pass to action mailer object id and there load object. It work!!! (not need to pass live object to mailer, only id)

@andersondias
Copy link
Owner

In order to use sidekiq_mailer you need to pass simple objects as parameters to actions. Instead of receiving complex Objects, such as User, you should pass user id, or any integer, string, boolean objects.

@scottkf
Copy link

scottkf commented Jun 11, 2014

In my case it was devise causing the problem, and a quick fix can be the following - you could also change devise as well

Sidekiq::Mailer.excluded_environments = [:test, :cucumber]


# monkey patch so sidekiq mailer doesn't handle devises backgrounding
#  which would try to serialize the user object
class Sidekiq::Mailer::Proxy

  def deliver
    return deliver! if Sidekiq::Mailer.excludes_current_environment? || @mailer_class.to_s == "Devise::Mailer"
    Sidekiq::Mailer::Worker.client_push(to_sidekiq)
  end

end

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

5 participants