iTranslated by AI
The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🤕
The one cool solution for mysterious broken characters in development.log on Rails and Docker
TL;DR
Add the following line to config/environments/development.rb.
config.web_console.allowed_ips = '0.0.0.0/0'
Phenomenon
- A large amount of mysterious strings are output to the first line of development.log
\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000...- Since they are null characters, they look like
NULLNULLNULLNULL...when opened in editors such as Visual Studio Code - Looking closely,
Cannot render console from ...is also displayed
Cause
- In Ruby on Rails 6.x, the
web-consolegem should be included when running in development- When running under Docker, you need to specify allowed IPs
Solution
Add the following line to config/environments/development.rb.
config.web_console.allowed_ips = '0.0.0.0/0'
Note:
Since the config name was changed in web-console 4.0.3, it seems that there is more information on the Web about config.web_console.whitelisted_ips.
References
- Rails 6: About config.hosts and whitelisted_ips in Docker dev environments | TechRacho by BPS Co., Ltd.
- rails commit log skim reading (2020/08/20) | Naru-yo-ni-naru Blog
Discussion