Rails provides named routes.
Routes helper can be called using path or url
eg from docs:
# and provide these named routes
root_url # =>
As the other answers explain, you should use _url in email links, etc.
But I would like to add that you should also use _url in redirects, as explained here:
https://www.ruby-forum.com/topic/101346#221052
and, here:
http://viget.com/extend/rails-named-routes-path-vs-url
You can also take a look at the relevant section of the HTTP specification here:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.30