Extend rails-settings-cached to merge db-saved hash values with defaults
This commit is contained in:
12
app/lib/settings/scoped_settings.rb
Normal file
12
app/lib/settings/scoped_settings.rb
Normal file
@ -0,0 +1,12 @@
|
||||
module Settings
|
||||
class ScopedSettings < ::Setting
|
||||
def self.for_thing(object)
|
||||
@object = object
|
||||
self
|
||||
end
|
||||
|
||||
def self.thing_scoped
|
||||
unscoped.where(thing_type: @object.class.base_class.to_s, thing_id: @object.id)
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user