You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generating a scaffold for a resource that is supposed to be nested under another requires a ton of changes after generating a regular scaffold.
We could create a nested_scaffold generator, that took care of this for us, by making a few assumptions.
Only index, new, and create actions are required to be nested under the parent resource. Edit, update, and destroy all operate on a concrete resource, ie with a given id, so it has no benefit from being nested.
resources :inventions do
resources :patent_applications, :only => [:create, :index, :new]
end
resources :patent_applications, :except => [:create, :index, :new]
Resources can only be nested one level deep. Having a House resource nested at /cities/:city_id/streets/:street/:street_id/houses/:id makes sense, it doesn't provide anything but long urls and url helper names when compared to having it at /houses/:id.
The text was updated successfully, but these errors were encountered:
Generating a scaffold for a resource that is supposed to be nested under another requires a ton of changes after generating a regular scaffold.
We could create a nested_scaffold generator, that took care of this for us, by making a few assumptions.
Only index, new, and create actions are required to be nested under the parent resource. Edit, update, and destroy all operate on a concrete resource, ie with a given
id
, so it has no benefit from being nested.Resources can only be nested one level deep. Having a
House
resource nested at/cities/:city_id/streets/:street/:street_id/houses/:id
makes sense, it doesn't provide anything but long urls and url helper names when compared to having it at/houses/:id
.The text was updated successfully, but these errors were encountered: