Comments (2)
I was baffled by the same issue but I believe I have found the cause and a (sort of less than ideal) solution.
It appears this problem is being caused by spring which keeps the Rails application loaded and therefore keeps the cache around. I had truncated the settings table at some point so I could reset it with new defaults. Afterwards my new settings weren't taking in the application or showing up in the database so I tried to mimic the behavior of #save_default
but with some extra output by doing the following
if Setting.application_title.nil?
puts 'Setting application_title.'
Setting.application_title = 'My Application'
end
just to make sure something weird wasn't going on. Setting.application_title
wasn't returning nil so the setting wasn't being set. I discovered that when I added Rails.cache.delete('settings:application_title')
before the above that it worked just fine. So of course the normal call to #save_default
worked just fine as well. So if you're using spring (which ships with Rails 4.1 by default) you might need to clear the cache for your settings before you use #save_default
.
from rails-settings-cached.
@seaneshbaugh Thank you very much for this. I had the same problem and your explanation saved me.
from rails-settings-cached.
Related Issues (20)
- Usage in i18n config files HOT 1
- Readme Typo
- ๐จ in "_table_exists?" the error rescuing is too generic.
- ๐จ fix for "_table_exists?" method HOT 4
- Support for metadata for fields HOT 1
- Default Proc setting does not work if it is readonly
- getting an undefined method for a setting HOT 6
- Unable to use AR scope functionality HOT 3
- Consider document ActiveRecord::Store as another alternative to Scoped Settings
- Disable RequestCache without Rails application HOT 2
- Caching is buggy in Rails 5 HOT 3
- ไป่ฎพ็ฝฎๅๅพๅผๅๆฟๅฐ็ไธไธ่ด HOT 2
- Configurable Cache Expiration HOT 1
- Rails 6.1.6.1 no longer loading Settings in /config/environments/*.rb HOT 1
- Field of Type Hash
- Updating a value doesn't invalidate cache in distributed system HOT 3
- Configurable cache storage feature HOT 3
- Version 2.9.0 breaks `type: :date_time` HOT 3
- Change in behavior for integer HOT 1
- ActiveAdmin interface for v2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rails-settings-cached.