What is the difference between _url and _path while using the routes in rails

前端 未结 7 2045
萌比男神i
萌比男神i 2020-12-04 07:27

When we define routes in routes.rb using the name like map.some_link.We can use the link in two ways- some_link_url, some_link_p

相关标签:
7条回答
  • 2020-12-04 08:11

    The _url helper generates a string containing the entire URL, while the _path helper generates a string containing the relative path from the root of the application, e.g.:

    photos_url  # => "http://www.example.com/photos"
    photos_path # => "/photos"
    

    As per Rails Guides - Routing.

    0 讨论(0)
提交回复
热议问题