Ask A Question

Notifications

You’re not receiving notifications from this thread.

Nested Model of an already nested model

RJ McCollam asked in Rails

I want to make sure my thinking is right more than anything else on this post. Hopefully I can explain myself clearly and get pointed in a good direction.

My Scenario

I have 3 models. Model A, Model B, and Model C.

Model A is the top level model and has Model B nested underneath it through a belongs_to/has_many setup.

I am needing to add a nested model (Model C) to Model B. Model C has not dependcy on Model A. Only Model B.

In building out Model C can I just go about it as I normally would using a belongs_to/has_many setup?

I imagine that going another level deep with nesting is possible, but I also imagine there are some special things to look out for in my routing and form setup.

My question in all of this being can I do it and what should I watch out for in doing so?

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,946+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.