This project is archived and is in readonly mode.
adding options to erb scaffold generator to include or skip custom views / templates
Reported by Deleted User | August 6th, 2010 @ 07:09 PM
When I was working on customizing the erb scaffold generator to match the style and design I wanted to use by creating custom templates in /lib/templates/erb/scaffold I found that I wanted to add additional files.
I can now do something like the following:
$ rails generate scaffold FitType key:string name:string description:text --add-views=_nav --skip-views=new ...
invoke erb
create app/views/fit_types
create app/views/fit_types/index.html.erb
create app/views/fit_types/edit.html.erb
create app/views/fit_types/show.html.erb
create app/views/fit_types/_form.html.erb
create app/views/fit_types/_nav.html.erb
Comments and changes to this ticket
-
Deleted User August 6th, 2010 @ 07:13 PM
- Tag set to patch
-
Robert Pankowecki August 7th, 2010 @ 10:44 AM
It seems quite nice but is it much better than just removing or adding those files later by yourself like
rails generate scaffold ... && rm app/views/fit_types/new* && touch app/views/fit_types/_nav.html.erb
?
-
Deleted User August 8th, 2010 @ 08:23 PM
- Tag cleared.
Much better? IMHO yes..
Since by having it as an option, I can set the argument in the configuration file, and not have to type anything extra at all for each invocation, allowing me to have the scaffolding the way I want it, each and every time I invoke it.
This is about saving time, and keystrokes so After invoking the scaffold, I have either no changes necessary, or very minimal changes to make to make the resulting pages meet functional and aesthetic spec.
-
Deleted User August 8th, 2010 @ 08:23 PM
- Tag set to patch
-
Andrea Campi October 9th, 2010 @ 05:24 PM
- Tag changed from patch to generators, patch
+1
Also, I verified the patch still applies cleanly and works as advertised.
-
Ryan Bigg October 11th, 2010 @ 12:10 PM
- Tag cleared.
- Importance changed from to Low
Automatic cleanup of spam.
-
Aditya Sanghi October 13th, 2010 @ 06:27 PM
+1
Seems nice. I like more options on generators and such like.
The patch could do with some tests though.
-
Aditya Sanghi October 13th, 2010 @ 06:28 PM
- State changed from new to incomplete
- Tag set to patch
Marking incomplete till we have patch with tests.
-
Deleted User October 19th, 2010 @ 04:56 PM
Please excuse me being new to this, but how would I write a test for this?
-
Andrea Campi October 19th, 2010 @ 10:14 PM
- Tag changed from patch to generators, patch
Try looking at @railties/test/generators/scaffold_generator_test.rb@, as well as the documentation for
run_generators
in @railties/lib/rails/generators/test_case.rb@; that should give you a starting point. -
Santiago Pastorino February 9th, 2011 @ 12:31 AM
- State changed from incomplete to open
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino February 9th, 2011 @ 12:31 AM
- State changed from open to stale
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>