How to redirect multiple levels of nested resources in Rails 3?

I know that I can point nested resources to routes.rbin Rails 3 as follows:

  resources :users do
    resources :posts 
  end

However, I would like to add commentsin posts. What should I write in my file routes.rb? Is it correct? Can I store their nesting?

  resources :users do
    resources :posts do
     resources :comments
    end
  end
+3
source share
4 answers

, , . , , . Rails Best Practices ( , 2, ). Jamis Buck .

+3

, , ..

+2

. , , .

+1

, , :

resources :users do
  resources :posts
end

resources :posts do
  resources :comments
end

API .

+1

Source: https://habr.com/ru/post/1789582/


All Articles