Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better nested scaffold generator #32

Open
koppen opened this issue Dec 4, 2017 · 0 comments
Open

Better nested scaffold generator #32

koppen opened this issue Dec 4, 2017 · 0 comments

Comments

@koppen
Copy link
Member

koppen commented Dec 4, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant