rubycoloredglasses


I'm Jason, a web application developer in East Tennessee.


Obtaining Request Domain Name for Ruby on Rails

I’m using Rails 2.3.8. To obtain the domain name for the website being requested (i.e. mysite.com, mysite.net), just reference ‘request.host’.

ruby@host = request.host

You can only reference request.host in the views, or the controller.

comments powered by Disqus