Skip to content

Commit

Permalink
How to disable scaffolds.scss in generators.md (#27383)
Browse files Browse the repository at this point in the history
* How to disable scaffolds.scss in generators.md

* Improves workflow customization text in generators.md
  • Loading branch information
eikes authored and eileencodes committed Dec 17, 2016
1 parent e3802f9 commit 28e49c7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion guides/source/generators.md
Expand Up @@ -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|
Expand Down

0 comments on commit 28e49c7

Please sign in to comment.