From dd5073a2bf2421e51aafe118ed4f6729bd6bca0a Mon Sep 17 00:00:00 2001 From: hachi8833 Date: Sat, 14 Oct 2023 13:35:57 +0900 Subject: [PATCH 1/3] Update document for changing view_component_path --- docs/guide/generators.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/guide/generators.md b/docs/guide/generators.md index bc3aadc6c..c2c6cf4a0 100644 --- a/docs/guide/generators.md +++ b/docs/guide/generators.md @@ -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 From 9913fdc8dda50ec3f109964e137245a7c0c9555e Mon Sep 17 00:00:00 2001 From: hachi8833 Date: Sat, 14 Oct 2023 13:58:09 +0900 Subject: [PATCH 2/3] Update docs/CHANGELOG.md --- docs/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index adef9aea7..ae86c2fb0 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -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* + ## 3.6.0 * Refer to `helpers` in `NameError` message in development and test environments. From 47e7372d96f4df125e87774abfd591e6e9d77b7c Mon Sep 17 00:00:00 2001 From: Cameron Dutro Date: Wed, 18 Oct 2023 10:39:10 -0700 Subject: [PATCH 3/3] Update docs/guide/generators.md --- docs/guide/generators.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guide/generators.md b/docs/guide/generators.md index c2c6cf4a0..bd54239f6 100644 --- a/docs/guide/generators.md +++ b/docs/guide/generators.md @@ -42,8 +42,8 @@ Generated ViewComponents are added to `app/components` by default. Set `config.v ```ruby # config/application.rb - config.view_component.view_component_path = "app/views/components" - config.eager_load_paths << Rails.root.join("app/views/components") +config.view_component.view_component_path = "app/views/components" +config.eager_load_paths << Rails.root.join("app/views/components") ``` ### Override template engine