from http://www.ruby-forum.com/topic/101346
The users_url helper generates a URL that includes the protocol and host name. The users_path helper generates only the path portion. users_url: http://localhost/users users_path: /users Mostly you should use the _path flavor. If you need to spec the host or protocol (like for talking to another app or service), then use the _url flavor.
本文解释了Rails框架中url辅助方法与path辅助方法的区别:url辅助方法生成包含协议和主机名的完整URL;而path辅助方法仅生成路径部分。通常推荐使用_path辅助方法,除非需要指定主机或协议。

被折叠的 条评论
为什么被折叠?



