I am trying to set the :host for action mailer default url options.
I have the below set in all the environment files
config.action_mailer.default_url_options = {
:host => "localhost"
}
I want to make it more dynamic by providing the request host.
when I try to set it by
config.action_mailer.default_url_options = {
:host => request.domain
}
OR
config.action_mailer.default_url_options = {
:host => request.env["SERVER_NAME"]
}
It throws error... doesn't recognize "request" object
is there any way I can set this to the request host, not by hardcoding...?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…