devise custom controller, custom mailer & opts[:options]

181 views
Skip to first unread message

tom

unread,
Dec 6, 2018, 1:55:10 PM12/6/18
to Ruby on Rails: Talk
hi,
in my app i need to set & send different emails. the app operates
under 3 domains, and so i want to the able to set the opt[] hash
accordingly with template and url options ...

--> from within the mailer i cannot access 'request' object, hence i
need to saty within my cusotm devise controller. but how can i pass
these variable to my mailer?


controller: class Users::PasswordsController < Devise::PasswordsController
before_filter :do_before
include ApplicationHelper

def do_before
p "PasswordsController :: do_before"
if request.host == 'foo.com'
@x = 'bar'
end
end

def create
p "PasswordsController :: create"
# how to get @x over to mailer????
super
end


===================
class DeviseCustomMailer < Devise::Mailer
include ApplicationHelper
include Devise::Controllers::UrlHelpers # Optional. eg. `confirmation_url`

def reset_password_instructions(record, token, opts={})
p "DeviseCustomMailer < Devise::Mailer :: reset_password_instructions"
p opts
opts[:template_name] = "@x ...?????
devise_mail(record, :reset_password_instructions, opts)
end



thank you
Reply all
Reply to author
Forward
0 new messages