class Setler::ScopedSettings

Public Class Methods

for_thing(object, scopename) click to toggle source
# File lib/setler/scoped_settings.rb, line 3
def self.for_thing(object, scopename)
  self.table_name = scopename
  self.defaults = settings_constantize(scopename).defaults
  @object = object
  self
end
settings_constantize(scopename) click to toggle source

do not use rails default to singularize because setler examples user plural class names

# File lib/setler/scoped_settings.rb, line 16
def self.settings_constantize(scopename)
  Object.const_get(scopename.to_s.camelize)
end
thing_scoped() click to toggle source
# File lib/setler/scoped_settings.rb, line 10
def self.thing_scoped
  self.base_class.where(thing_type: @object.class.base_class.to_s, thing_id: @object.id)
end