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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With