devise_invitable
devise_invitable copied to clipboard
invitation_instructions undefined
Upgrading from Rails 3.2 to 4.1.8 and I'm getting:
undefined method `invitation_instructions' for Devise::Mailer:Class
But when I go into the terminal, it seems to be included in the class:
jruby-1.7.15 :003 > Devise::Mailer.respond_to?(:invitation_instructions) => true
Not entirely sure why its resulting in an undefined method error.
Environment: Devise 3.4.1 Devise_invitable 1.4.0 JRuby 1.7.15 Mac OS X
Work around, I have to put the invitation_instructions method into the Devise::Mailer class.
The issue seems to happen when the mailer runs in the background with Torquebox 3.1.1.
Any help/suggestions greatly appreciated.
Have changed the devise::mailer class?
I don't know why it doesn't work correctly when when backgrounded by Torquebox; it works correctly when if the mailer runs normally. I don't know if its a Rails 4 issue or something else. I've moved on but will need to circle back and find out whats causing the problem.
Maybe torquebox is not initializing every gem, maybe you could add some require, I'm sorry not being more specific, I don't know torquebox.
I had a similar problem (rails 4.0.13, sidekiq, custom devise mailer). I could isolate the error to devise_invitable upgrade from 1.3.5 to 1.3.6, and more specifically to commit 9d0b154. I solved it by adding Devise::Mailer.send :include, DeviseInvitable::Mailer to the beginning of my custom devise mailer file. Will change to devise-async in the near future.
Will try that out.Thanks @luisico !
I don't understand why you need that, @luisico I think it should work using Devise.mailer instead of Devise::Mailer. Have you changed mailer in devise initializer?
Yes, I have a custom mailer for sending mails in the background with sidekiq. The code is the same as in the last gist at https://github.com/mperham/sidekiq/wiki/Devise. I guess the changes you introduced in 9d0b154 make DeviseInvitable::Mailer available in Devise.mailer (my custom mailer), but not in Devise::Mailer, which my custom mailer calls internally.
In the near future I plan to use devise-async and not a custom mailer.
Thanks for that tid bit. I'll look into implementing that when I get a chance.
On Mon, Feb 2, 2015 at 11:35 AM, Luis Gracia [email protected] wrote:
Yes, I have a custom mailer for sending mails in the background with sidekiq. The code is the same as in the last gist at https://github.com/mperham/sidekiq/wiki/Devise. I guess the changes you introduced in 9d0b154 https://github.com/scambra/devise_invitable/commit/9d0b154f7a40bc052198c4845fb0043ce8c153ce make DeviseInvitable::Mailer available in Devise.mailer (my custom mailer), but not in Devise::Mailer, which my custom mailer calls internally. In the near future I plan to use devise-async and not a custom mailer.
— Reply to this email directly or view it on GitHub https://github.com/scambra/devise_invitable/issues/524#issuecomment-72500122 .
Thanks!
Blia Xiong [email protected]
Yes, that's right. Devise.mailer is usually used to override devise mailer with a custom one which inherits from Devise::Mailer, include DeviseInvitable::Mailer in Devise::Mailer doesn't work for those custom mailers.
Maybe I can include DeviseInvitable::Mailer into Devise.mailer and Devise::Mailer, hopefully it will work for both cases, but I need to test it doesn't break custom mailers
Thanks!
On Tue, Feb 3, 2015 at 3:15 AM, Sergio Cambra [email protected] wrote:
Yes, that's right. Devise.mailer is usually used to override devise mailer with a custom one which inherits from Devise::Mailer, include DeviseInvitable::Mailer in Devise::Mailer doesn't work for those custom mailers.
Maybe I can include DeviseInvitable::Mailer into Devise.mailer and Devise::Mailer, hopefully it will work for both cases, but I need to test it doesn't break custom mailers
— Reply to this email directly or view it on GitHub https://github.com/scambra/devise_invitable/issues/524#issuecomment-72617352 .
Thanks!
Blia Xiong [email protected]