Upgrading from Avo 3.15 to 3.17 turned into a multi-hour ordeal due to a new gem dependency: Config.
After upgrading Avo and which installed the Config gem, I started encountering the following error:
/Users/jclarke/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/config-5.5.2/lib/config/options.rb:156:in method_missing': private method autoload?' called for an instance of Config::Options (NoMethodError) from /Users/jclarke/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/zeitwerk-2.7.1/lib/zeitwerk/cref.rb:39:in autoload?' from
ChatGPT initially suggested that the issue was related to Zeitwerk, but since the Zeitwerk version hadn’t changed, I knew the error had something to do with the Config gem. However, the error message wasn't very helpful, as it pointed to the method_missing method.
After having no luck with ChatGPT or Grok and trying various solutions, I created a new branch and systematically deleted controllers and config files until rails c worked again.
Eventually, I deleted our SettingsController, and bam—the app loaded again!
It turns out the Config gem uses a global object called Settings:
h(dev)> Settings Config::Options {}
It seems risky for a gem to use such a generic global variable, but that was the issue. I had to rename our SettingsController and its subcontrollers to UserSettings, and everything started working again.
Update:
Found another way to fix it to rename Settings for the config gem
config/initializers/config.rb Config.setup do |config| config.const_name = 'ConfigSettings' end