Rails 3 routing: Avoiding Deep Nesting

后端 未结 1 749
没有蜡笔的小新
没有蜡笔的小新 2021-01-12 14:52

Today I realised I\'d gotten a little carried away with nested resources:

resources :organisations do
  resources :studies do
    resources :settings
  end
e         


        
相关标签:
1条回答
  • 2021-01-12 15:29

    You pretty much got it figured out and on the right track. It really depends on your domain. Just looking at your routes, I would ponder on what Settings does. Maybe a namespace somewhere to handle settings would suffice, maybe not. Really depends on what you are trying to do.

    However, as far as nesting goes. It's looking fine.

    PS. You can also refer to this guide for routing in Rails 3.0.X.

    0 讨论(0)
提交回复
热议问题