V
V
Vitaly Liber2015-07-05 16:30:46
Ruby on Rails
Vitaly Liber, 2015-07-05 16:30:46

How to properly organize nested resources in rails?

I have four resources, how do I properly organize them in a rails application?
There are projects. The projects have conclusions. The conclusions have comments. Comments should contain responses to comments.
I would be glad to detailed manuals on this kind of connections and links to similar applications.
Of particular interest is the design of links in the routes.rb file and application models.
As I understand it, more than two nested links in the routes.rb file are not welcome .. The question arises how to properly and beautifully (in the spirit of DRY) organize such nested resources.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Risent Veber, 2015-08-28
@risentveber

On the official site: Rails Routing from the Outside In Ctrl+f on 'nested'
Like this:

resources :projects do
  resources :conclusions do
    resources :notes do
      resources :answers
    end
  end
end

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question