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

easonlovejiven · January 26, 2015 · Last by cloude9101 replied at January 26, 2015 · 1697 hits

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。

You need to Sign in before reply, if you don't have an account, please Sign up first.