Avoid deep routing in Rails yet still nest when needed -
I am putting my resources in deep nests and now it shows that it should be avoided. The answer to the shallow nesting victim is, but on the other side I am struggling to recover deep nesting properly. Let me show you the files of your routes as I think it will make it clear (I'm using Rail 4):
OLD:
Resources: Members do the resource: Email resources: Events are resources: end of item end
New so far:
Resources: Members, shallow: Correct resources : Email Processing: Events Ended
My problem is that I do not understand now where : Items should be placed? I thought that : index should be nested under : Events for new, and: Create tasks?
What am I missing, I am sure that this is something silly that I am not able to get it yet, please forgive my ignorance and I think that you can advance any help Are !!!
Mark
All you need to do is, Update:
Resources: Member, Shallow: Correct the resources: Email resources: Events, Shallow: Correct the resources: End of item
From there will be shallow routes to items
only : index
, : new
, and : to create
actions / events /: event_id
with nested routes.
Comments
Post a Comment