rails-settings-cached icon indicating copy to clipboard operation
rails-settings-cached copied to clipboard

Rails 6.1.6.1 no longer loading Settings in /config/environments/*.rb

Open cweilemann opened this issue 2 years ago • 1 comments

Hey @huacnlee - I'm upgrading an app (slowly) to Rails 7, and in Rails 6.1.6.1, I'm getting the following error

/Users/cweilemann/Projects/app/config/environments/production.rb:99:in `block in <top (required)>': uninitialized constant Setting (NameError)
Did you mean?  String

This didn't happen in Rails 5. I'm using the zeitwork gem. I checked the Rails Guide for Autoloading and Reloading Constants but that didn't help. Any suggestions?

cweilemann avatar Jul 26 '22 17:07 cweilemann

@cweilemann The answer is here: https://github.com/huacnlee/rails-settings-cached#readonly-field

# You must require_relative directly in Rails 6.1+ in config/environments/production.rb
require_relative "../../app/models/setting"

tjku avatar Aug 23 '22 12:08 tjku