'resources:controller_name'在routes.rb中做了什么?

时间:2016-01-10 04:41:21

标签: ruby-on-rails-4

非常新,并且用这种语言掌握了我的基本知识。

资源”关键字在routes.rb文件中的作用是什么?

1 个答案:

答案 0 :(得分:0)

如果以非常简单的方式:

resources :user do
  resource :profile
end

表示您有很多users,可以通过/users/1users/2等获取,但每个user只有一个profile而您可以通过/users/1/profile

获取

users包含所有标准操作,例如indexnewshowcreateeditupdatedestroyprofile有相同的内容,index

你应该更深入地阅读Rails Routing