Reputation: 998
It seems like the general consensus is to use resource_path
in URLs unless there's an explicit reason to use resource_url
(like linking to/away from an SSL page, or a different subdomain).
I've run into bugs from time to time from using _path
, so don't use it anymore, but when I googled this, most people say to use _path
unless it's necessary to use _url
. Is there any particular reason that I should not be doing this, or is it just bad form?
Upvotes: 2
Views: 182
Reputation: 4524
As a rule of thumb
_path
for internal links_url
for external and CDN type linksUpvotes: 5
Reputation: 489
root_url => http://localhost:3000/
root_path => /
employees_url => http://localhost:3000/employees
employees_path # => /employees
For more details check these links out: http://smalltawc.blogspot.de/2013/02/difference-between-url-and-path-in.html http://viget.com/extend/rails-named-routes-path-vs-url
Upvotes: 2