While the Rails scaffold system is a huge time-saver, I have found that a given site will have a different set of views, based on the particular framework. Up until recently I would manually edit each of the five view files {_form, edit, index, new, show} to suit the particular design, but this is getting old.
The ability to over-ride the default templates is an excellent new feature, and I now use that quite a bit. The problem is, I might have a lot of controllers and views, and if I need to redo the html in the view files after they have been created, I need to edit them all or use an elaborate 'sed' command.
I would prefer to be able to re-run the scaffold generator but just for the views. Something like:
$ rails g redo-views Post
This would recreate the five files from the new template, leaving the controller, model, migration and everything else, alone. The only alternative I can think of is to create a dummy site separately, and the manually copy the view files for each controller. This also requires that I know the parameters originally used during the scaffold generation, so it can create the right fields.
Is there a better/easier way?
Aucun commentaire:
Enregistrer un commentaire