3

Im having 2 different languages in my rails app and would like to be able to set the domain name set in the right language. For example if a user registers from app.FR I want in below example the extension .FR used instead of .COM is there a way to do that?

  config.action_mailer.asset_host = "http://app.com"
  config.action_mailer.default_url_options = {:host => 'app.com'}
Rubytastic
  • 15,001
  • 18
  • 87
  • 175

1 Answers1

1

It seems that the solution is setting a before filter in your ApplicationController and make a function like:

  def set_mailer_host
    ActionMailer::Base.default_url_options[:host] = request.host_with_port
  end

Remember when sending mail from rails console this will not work since rails console will not pass true ActionController.

Rubytastic
  • 15,001
  • 18
  • 87
  • 175
  • It seems there is [a security concern](http://excid3.com/blog/change-actionmailer-email-url-host-dynamically/#comment-936682084). – hiroshi Jan 16 '15 at 09:47