tom
2018-12-06 18:54:35 UTC
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
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
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+***@googlegroups.com.
To post to this group, send email to rubyonrails-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMeJF%3D5ODH7NN%3D0nH6LG1pcwY0AaD5bo%3DpHgPGd7yL1H9g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+***@googlegroups.com.
To post to this group, send email to rubyonrails-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CADQqhMeJF%3D5ODH7NN%3D0nH6LG1pcwY0AaD5bo%3DpHgPGd7yL1H9g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.