Config.action_mailer.default_url_options = { :host => }

In my application I have a mail sending part in which a user get mail
with a link to activate his account. What I am currently doing is as a
part of test I created a staging environment And in
config/environments/staging.rb I write like
config.action_mailer.default_url_options = { :host => “Ip_address_here”

 It is working fine And the user get a mail with content say to


  Now a problem I find is suppose if have to test the same

application in another server in another location I have to edit the
above to match the IP address of that machine And one more problem is
if it is hosted in a public IP a user belong to that network get a mail
like say Click
http://72.x.x.x/actiavate/token to activate. But it may not work from
that network. So agin I have to edit and change it
My question: Is this the standard way ?.Please advise me the correct
approach to do this. Or Can I use ActionController::Request class for

Thanks in advance

Use a url. :host => “localhost:3000” or :host => “

Dieter L.

Hi Dieter
Your answer, if I undersood correctly is to specify like

config.action_mailer.default_url_options = { :host => “localhost:3000” }

 in enviroment. This is what I do now. But my question is how to 

make it dynamic. Means some thing like

config.action_mailer.default_url_options = { :host =>
request.host_with_port() }

  And also only at a single place to make it DRY