This project is archived and is in readonly mode.
Shouldn't script/generate scaffold create partials?
Reported by Dennis Theisen | May 25th, 2008 @ 07:04 PM
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:
-
_post.html.erb
to view my Posts -
_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.
Comments and changes to this ticket
-
DHH May 31st, 2008 @ 09:28 PM
- 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.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Tags
Referenced by
- 981 Fix for routing optimization code Related info: http://dev.rubyonrails.org/ticke... - origi...
- 2142 DRYing up scaffold generator by generating a form partial For the reasons stated in #251