How to disable scaffolds.scss in generators.md (#27383)

* How to disable scaffolds.scss in generators.md

* Improves workflow customization text in generators.md
This commit is contained in:
Eike Send 2016-12-17 18:29:55 +01:00 committed by Eileen M. Uchitelle
parent e3802f9617
commit 28e49c711e
1 changed files with 9 additions and 1 deletions

View File

@ -208,7 +208,15 @@ $ bin/rails generate scaffold User name:string
Looking at this output, it's easy to understand how generators work in Rails 3.0 and above. The scaffold generator doesn't actually generate anything, it just invokes others to do the work. This allows us to add/replace/remove any of those invocations. For instance, the scaffold generator invokes the scaffold_controller generator, which invokes erb, test_unit and helper generators. Since each generator has a single responsibility, they are easy to reuse, avoiding code duplication.
Our first customization on the workflow will be to stop generating stylesheet, JavaScript and test fixture files for scaffolds. We can achieve that by changing our configuration to the following:
If we want to avoid generating the default `app/assets/stylesheets/scaffolds.scss` file when scaffolding a new resource we can disable `scaffold_stylesheet`:
```ruby
config.generators do |g|
g.scaffold_stylesheet false
end
```
The next customization on the workflow will be to stop generating stylesheet, JavaScript and test fixture files for scaffolds altogether. We can achieve that by changing our configuration to the following:
```ruby
config.generators do |g|