diff options
author | alpaca-tc <alpaca-tc@alpaca.tc> | 2017-05-25 21:14:36 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-05-25 14:14:36 +0200 |
commit | 08dce5e60792112ca8df4aa5de3663fd7ad51e77 (patch) | |
tree | c007e13c212b1c2f1a5e75937500b5196017604e /app/models | |
parent | 2469fd1cdcbb3778878a33a7879d5f1fa563c476 (diff) |
Refactor Setting (#3302)
* @object is not needed * Remove unneeded dependencies * Do not call private method * Prefer #respond_to_missing? over #respond_to? `#respond_to?` doesn't support `User.settings.method(:method_name)` * Use find_or_initialize_by instead of
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/setting.rb | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/app/models/setting.rb b/app/models/setting.rb index f5c95777a..e0107dd83 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -23,7 +23,7 @@ class Setting < RailsSettings::Base def [](key) return super(key) unless rails_initialized? - val = Rails.cache.fetch(cache_key(key, @object)) do + val = Rails.cache.fetch(cache_key(key, nil)) do db_val = object(key) if db_val @@ -50,8 +50,6 @@ class Setting < RailsSettings::Base records end - private - def default_settings return {} unless RailsSettings::Default.enabled? RailsSettings::Default.instance |