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

前端 未结 7 2051
萌比男神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:09

    By secure if you mean not exposing all the data passed, then _path is better as it generates a relative url, something like '/login' but _path would give 'http://localhost:3000/login'. Please refer to this blog post i found sometime back regarding the same. When _url is better than _path

提交回复
热议问题