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
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user