[RUBY] What to do when Rails on Docker does not reflect controller changes in the browser

problem

Changes to controller.rb are not reflected in the browser. It will be reflected if you restart the container, but it takes time to restart every time.

environment

Windows 10 home Docker for Windows Rails 6.1 Ruby 2.7

solution

In config \ environments \ development.rb Modify config.file_watcher = ActiveSupport :: EventedFileUpdateChecker to the following code.

config.file_watcher = ActiveSupport::FileUpdateChecker

What i don't understand

You can also solve it by writing the code below. I couldn't tell the difference from the above code by looking at the Rails guide, so if anyone can understand the difference, I would appreciate it if you could teach me.

config.reload_classes_only_on_change = false

See also: Rails Guide-Setting up Rails applications (https://railsguides.jp/configuring.html)

reference

  1. Rails 5 doesn't reflect model and controller modifications
  2. Resolved the phenomenon that code changes are not reflected in development of Vagrant + Rails 6.0.2.1
  3. [Rails 6] Source code is not reflected unless Docker container is restarted

Recommended Posts

What to do when Rails on Docker does not reflect controller changes in the browser
What to do when rails db: seed does not reflect in the database
What to do when the changes in the Servlet are not reflected
[Rails] What to do when rails s does not respond or does not stop
What to do when ‘Could not find’ in any of the sources appears in the development environment with Docker × Rails × RSpec
What to do when "relation" hibernate_sequence "does not exist" in the ID column of PostgreSQL + JPA
[Rails 5] [Turbolinks] What to do when JS does not work due to page transition or browser back
When Docker for Mac 2.4.0.0 does not reflect file changes
[Grails] Error occurred running What to do when the Grails CLI does not start
What to do if the update does not take effect after deploying Rails AWS
What to do when Method not found in f: ajax
What to do when a could not find driver appears when connecting to a DB in a Docker environment
[Rails Tutorial Chapter 2] What to do when you make a mistake in the column name
[Rails] What to do if data is not registered in DB
What to do if the Rails page doesn't appear in Rails tutorial 1.3.2
[Rails] What to do when the error No database selected and Unknown database appears in db: migrate
[Programming beginner] What to do when rails s becomes an error in the local development environment
[Note] What to do if bundle install in Chapter 3 of the rails tutorial is not possible
What to do if the app is not created with the latest Rails version installed when rails new
What to do if the prefix c is not bound in JSP
What to do when "call'Hoge.connection' to establish a connection" appears on rails c
Notes on what to do when a WebView ClassNotFoundException occurs in JavaFX 12
What to do if Operation not permitted is displayed when you execute a command in the terminal
[Rails / Docker] What to do if access is denied by the browser (localhost: 3000) after adding a gem
What to do when debugging "Source not found"
What to do when IllegalStateException occurs in PlayFramework
What to do when the value becomes null in the second getSubmittedValue () in JSF Validator
What to do when is invalid because it does not start with a'-'
What to do if the rails server doesn't run out on AWS cloud9
What to do if ffi installation fails when launching an application in Rails
[Rails] What to do when the Refile image is not displayed when writing the processing at the time of Routing Error
[Rails] What to do if you get an error saying "Could not find a JavaScript runtime." When executing the rails s command on Catalina
What to do when The SSL certificate has expired
What to do when JSF tags do not become HTML
Bundle install with docker + rails6 does not reflect gem
What to do when rails creates a 〇〇 2.rb file
When the server does not start with rails s
What to do when "Fail to load the JNI shared library" is displayed in Eclipse
What to do when Address already in use is displayed after executing rails s
What to do when routing settings do not work after building Docker environment with Laravel
What to do if the JSONHint annotation does not work with lombok and JSONIC
What to do if the breakpoint is shaded and does not stop during debugging
"Do not show again" check does not work in the warning dialog when starting applet
[Joke] What to do when the invalid sample rate is reached when using Mixxx on Ubuntu 20.04
The story when the test folder was not created in Rails
[Ruby on Rails] When parameter id acquisition does not work
What to do when you launch an application with rails
One of the causes and solutions when whales do not appear in Docker Quickstart Terminal
[Ruby on Rails] Quickly display the page title in the browser
[Rails] What to do if you accidentally install bundle in the production environment in your local environment
What to do if audio is not available on discordrb
What to do if you installed Ruby with rbenv but the version does not change
How to solve the problem when the value is not sent when the form is disabled in rails and sent
Docker does not work when DOCKER_HOST is specified in WSL2
Bluemix Infrastructure VPN does not connect because it does not support NPAPI! What to do when [Mac]
What to do if you get a "302" error in your controller unit test code in Rails
How to get the log when install4j does not start
[Rails] What to do when the view collapses when a message is displayed with the errors method
What to do if you can't use the rails command
What to do if you select a JRE in Eclipse and get "The selected JRE does not support the current compliance level 11"
When you want to reflect the Master Branch information in the Current Branch you are currently working on