LoginSignup
0
0

More than 3 years have passed since last update.

Docker上のRailsでコントローラーの変更がブラウザに反映されない時の対処法

Last updated at Posted at 2021-01-01

問題

controller.rbの変更がブラウザに反映されない。
コンテナを再起動すれば反映されるが、毎回再起動するのは手間がかかる。

環境

Windows 10 home
Docker for Windows
Rails 6.1
Ruby 2.7

解決策

config\environments\development.rb内の
config.file_watcher = ActiveSupport::EventedFileUpdateCheckerを下記コードに修正する。

config.file_watcher = ActiveSupport::FileUpdateChecker

わからないこと

下記コードを記載しても解決できる。
Railsガイドを見ても上記コードとの違いがわからなかったので、違いが分かる人がいましたら、ご教授いただければ幸いです。

config.reload_classes_only_on_change = false

参照:『Railsガイド』- Rails アプリケーションを設定する

参考

  1. Rails5でmodelやcontrollerの修正が反映されないやつ
  2. Vagrant + Rails 6.0.2.1 のdevelopmentでコード変更が反映されない現象を解決
  3. 【Rails6】Dockerコンテナを再起動しないとソースコードが反映されない
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0