huacnlee / rails-settings-cached

Global settings for your Rails application.
Other
1.06k stars 202 forks source link

Caching not happening on Rails 7.1.3 #245

Closed karant closed 9 months ago

karant commented 9 months ago

Hello, went through upgrading from Rail 6.0.5 to Rails 7.1.3. rails-settings-cached upgraded to latest version 2.9.4.

What I am seeing in rails console in development environment is that DB is getting hit ever time a call Setting.x whereas if I do the same on production environment in heroku (where it still remains on older version), it only hits DB once and then uses cache, as expected.

I did try adding this line in development.rb but saw no difference:

You must require_relative directly in Rails 6.1+ in config/environments/production.rb

require_relative "../../app/models/setting"

Are there any known reasons for why caching would stop working with Rails 7.1.3? Any tips on how I could troubleshoot it further?

karant commented 9 months ago

Just had to run "rails dev:cache". Issue closed.