Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Breaking change] Chanko no longer modifies view_paths to add or remove its own view path. #78

Merged
merged 2 commits into from
Mar 7, 2024

Conversation

eudoxa
Copy link
Contributor

@eudoxa eudoxa commented Oct 6, 2023

Rails 7.1で、viewの探索対象を管理するPathSet#pathsがfreezeされました。この変更でChankoの利用可能viewを動的に管理する仕組みが動かなくなります。

この仕組みはUnitのviewを外から不用意に利用する事を避けるためでしたが、無理をして維持する価値はおそらくないため、今回を機に関連コードと機能を削除します。

今後、Chankoはviewsに関して何の仕組みも持ちません。代替する管理方法の一例として、他のassetsと同様にapp/views/の下にシンボリックリンクを作成する方法をREADMEに追加しました。

Before

touch app/units/my_unit/views/_example.html.erb

# my_unit.rb
scope(:view) do
  function(:function_name) do
    render "/example"
  end
end

After

touch app/units/my_unit/views/_example.html.erb
ln -s app/units/my_unit/views/ app/views/units/my_unit/

# my_unit.rb
scope(:view) do
  function(:function_name) do
    render "/units/my_unit/example"
  end
end

@eudoxa eudoxa force-pushed the no_longer_add_unit_path_to_view_paths branch 5 times, most recently from 9a6836a to 24df553 Compare October 7, 2023 04:44
@eudoxa eudoxa force-pushed the no_longer_add_unit_path_to_view_paths branch from 24df553 to 1ffcd1e Compare October 7, 2023 06:23
@eudoxa eudoxa changed the title [Breaking change] Chanko no longer operates on view_paths to add or remove looking path. [Breaking change] Chanko no longer modifies view_paths to add or remove its own view path. Oct 7, 2023
@eudoxa eudoxa marked this pull request as ready for review December 28, 2023 03:52
README.md Outdated
end
end
```
In its previous version, Chanko added the views path of the unit to Rails' view file search. However, it no longer does that. If you still want to place the views path under the unit, please create a symbolic link under app/views/units and refer to it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

大きな変更だから、メジャーバージョンをあげるほうが良さそうですね。今が2だから3かな。
previous versionというより、3より前のバージョンにするのが良いかなと。

Copy link
Contributor Author

@eudoxa eudoxa Feb 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

たしかにそのように書いたほうが分かりやすいですね。変更をします。バージョンの方針も相違ありません。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In version 2 and earlier, Chanko extended Rails' search path to include the views path of the unit. This functionality has been discontinued. To maintain the views path under the unit, you will need to manually create a symbolic link in app/views/units to access it.

としました。このコードをマージ後にREADMEの修正など、version3への準備を行います。

@eudoxa eudoxa merged commit a544457 into cookpad:master Mar 7, 2024
16 checks passed
eudoxa added a commit to eudoxa/chanko that referenced this pull request Mar 8, 2024
cookpad#78

- Adds support for Rails 7
- Drops support for eol versions of Ruby and  Rails.
eudoxa added a commit to eudoxa/chanko that referenced this pull request Mar 8, 2024
cookpad#78

- Adds support for Rails 7
- Drops support for eol versions of Ruby and  Rails.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants