Rails Ruby on Rails 当中的路由具体有什么作用

easonlovejiven · 2015年01月26日 · 最后由 cloude9101 回复于 2015年01月26日 · 1697 次阅读

ruby on rails 当中的路由具体有什么作用,,,网上查的解释的太模糊!!!求解

建议楼主看文档,http://guides.rubyonrails.org/routing.html 解释:

The Rails router recognizes URLs and dispatches them to a controller's action. It can also generate paths and URLs, avoiding the need to hardcode strings in your views.

routes 是 rails 开始的第一步,controller 对路由请求做“处理”。view 和 model 是“被处理”的对象。

访问一个 url 时,routes 决定了处理这个 url 时所用 controller。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号