Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Shouldn't script/generate scaffold create partials?

#251

Whenever I use the scaffold-generator for a model, I always find me editing the New, Edit, Show and Index views to render partials.

Example:

I have a Post model. Then I always need:

  1. _post.html.erb to view my Posts
  2. _edit_post.html.erb to edit/create my Posts

Is there any reasons the generator should not create these two partials and then call them in the CRUD-views?

It would also get new users into the habit of using partials, when they have been already created for them.

Maybe I could implement it myself - though I've never contributed anything yet and it could take my fairly long - if someone says it would be a welcome patch.

Reported by Dennis Theisen · May 25th, 2008 @ 07:04 PM

State: resolved
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. DHH
    DHH
    • State changed from new to resolved

    I don't think it should. Partials make it harder to follow and are great as a first "exercise for the reader". Scaffold code doesn't really need to be optimized, it's more important to teach some simple lessons and invite people to change it.

    May 31st, 2008 @ 09:28 PM