I use Devise for authentication in my Rails app.
In my registrations_controller
I set an instance variable like this:
class RegistrationsController < Devise::RegistrationsController
def create
@foo = "bar"
super
end
end
In my customized mailer I then try to access the @foo
instance variable, but it just returns nil
:
class CustomMailer < Devise::Mailer
helper :application
include Devise::Controllers::UrlHelpers
def confirmation_instructions(record, token, opts={})
Rails.logger.error @foo.inspect # => nil
super
end
end
Anyone who could help?
I have looked through the posts How do I add instance variables to Devise email templates?, How to pass additional data to devise mailer?, How to pass instance variable to devise custom mailer in Rails?. But none of them seem to deal with this exact problem.