views:

15

answers:

1

I am making a dynamic URL in my rails app like

http://localhost:3000?#{something}=#{something1}

How do I get rid of the hardcoded domain name (localhost in this case). I want to deploy this app to heroku and heroku will give its own domain name. I don't want to again change my code to suit the domain name that heroku gives.

Is this possible?

A: 

Replace localhost:3000 with request.host_with_port

http://api.rubyonrails.org/classes/ActionController/Request.html#M000521

Anand