1

So I have four models, A, B, C, and D that I associate with has_many and belong_to. I want to have a nested route formation for D.

D belongs_to A, B and C and there is no case that it can be otherwise. However when creating a nested resource for this route I am doing:

resources :A do
  resources :B do
    resources :C do
      resources :D 
    end
  end
end

Now this creates the url I want, but I don't need any of the resources from B and C creating under this formation. So I will never have a new_A_B_path call anywhere in my code. All I want is to know A, B and C when I'm creating or editing a new D.

What is the right way to handle this?

eytanfb
  • 443
  • 4
  • 17
  • related : http://stackoverflow.com/q/6722900/684934 . You should be aware that deep nesting is advised against, simply because it makes URIs and helper method names and argument lists long. –  Jul 18 '13 at 00:50
  • thanks for guiding me there. so what I understand there is, it's not that big a deal unless the url is still readable – eytanfb Jul 18 '13 at 00:54

0 Answers0