Skip to content

Commit

Permalink
[Docs]Update document for changing view_component_path (#1870)
Browse files Browse the repository at this point in the history
* Update document for changing view_component_path

* Update docs/CHANGELOG.md

* Update docs/guide/generators.md

---------

Co-authored-by: Cameron Dutro <[email protected]>
  • Loading branch information
hachi8833 and camertron authored Oct 18, 2023
1 parent d10f9ae commit f087bcf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ nav_order: 5

*Alexandre Ignjatovic*

* Update generators.md to clarify the way of changing `config.view_component.view_component_path`.

*Shozo Hatta*

* Improve docs about inline templates interpolation

*Hans Lemuet*
Expand Down
8 changes: 7 additions & 1 deletion docs/guide/generators.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ bin/rails generate component Sections::Example title content

You can specify options when running the generator. To alter the default values project-wide, define the configuration settings described in [API docs](/api.html#configuration).

Generated ViewComponents are added to `app/components` by default. Set `config.view_component.view_component_path` to use a different path.
Generated ViewComponents are added to `app/components` by default. Set `config.view_component.view_component_path` to use a different path. Note that you need to add the same path to `config.eager_load_paths` as well.

```ruby
# config/application.rb
config.view_component.view_component_path = "app/views/components"
config.eager_load_paths << Rails.root.join("app/views/components")
```

### Override template engine

Expand Down

0 comments on commit f087bcf

Please sign in to comment.