In my Rails/Devise app I need to manually send confirmation email for user with specific role and delay its sending.
What I do now is: a) In User.rb:
before_save :skip_mail_if_role1
def skip_mail_if_role1
self.skip_confirmation_notification! if self.role == 'role1'
end
b) In custom signup controller for this role user:
Devise::Mailer.confirmation_instructions(resource, resource.confirmation_token).deliver_later(wait: 5.minutes)
Of course I get an email with wrong token and button click does nothing. Any dummy token also does nothing. When I pass no second argument I get arguments error (there should be 2 of them at least and this is werid as far as here they pass only user
argument).
So I wonder what am I to pass there as a token from controller to make this work?
UPDATE:
Using this instruction I implemented custom devise MyMailer
but I still have no idea what should I pass as token
attribute in controller while calling MyMailer.confirmation_instructions(resource, ????).deliver