Reputation: 6165
When you do map.resources on a model, it generates a bunch of routing helpers:
resource_path(@resource)
resource_url(@resource)
new_resource_url
etc.
What's the difference between using _path and _url? From what I've tried it doesn't seem to make any difference.
Upvotes: 5
Views: 2876
Reputation: 17790
foo_url
includes the domain and protocol. foo_path
only outputs the relative path.
>> foo_url(:id => 1)
http://localhost:3000/foo/1
>> foo_path(:id => 1)
/foo/1
Most of the time, you want "_path" but you have the choice.
Upvotes: 8