Getting Local Hostname

In Rails, there is request.host or request.host_with_port that you can use in your controllers.