Have you ever wondered what is difference between _path
and _url
in Ruby on Rails?
For example root_path
and root_url
. As it turns out, _path
only returns the url relative to your domain.
For instance, root_path
returns /
while root_url
returns http://mydomain.com/
.
You should always use _url
for redirects and _path
for hyperlinks unless you have a good reason not to do so.
So far so good, That’s it! See ya! :)