Was*_*per 11 routes ruby-on-rails nested-resources nested-routes ruby-on-rails-3
美好的一天,
有人可以帮助我使用嵌套资源及其最佳实践.
我想我的限制:events路由只:show和:index,这是做它的正确方法是什么?
resources :events do
resources :registrations, :except => [:index]
end
resources :events, :only => [:index, :show]
Run Code Online (Sandbox Code Playgroud)
这是最好的方式还是更多Rubyist会处理这种事情的方式?我添加了两行resources :events或有没有办法将它们组合在一个块中?
提前致谢.
Ser*_*nin 19
是.您可以将它组合在一个块中,如:
resources :events, only: [:index, :show] do
resources :registrations, except: :index
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2750 次 |
| 最近记录: |