class Golden::Setting::Base

Public Class Methods

has_attribute?(name) click to toggle source

For SimpleForm#find_attribute_column

# File lib/golden/setting/base.rb, line 27
def has_attribute? name
  named(name).exists?
end
method_missing(method, *args) click to toggle source

For SimpleForm#find_attribute_column def type_for_attribute name; end

Calls superclass method
# File lib/golden/setting/base.rb, line 34
def method_missing method, *args
  super method, *args
rescue NoMethodError
  name = method.to_s
  if name =~ /=$/
    name.gsub!('=', '')
    self[name] = args.first
  elsif name =~ /\?$/
    name.gsub!('?', '')
    self.is_true? name
  else
    self[name]
  end
end
named(name) click to toggle source
# File lib/golden/setting/base.rb, line 18
def named name
  without_resource.where(name: name)
end
select_object(fields = %w{name value form_options}) click to toggle source
# File lib/golden/setting/base.rb, line 22
def select_object fields = %w{name value form_options}
  without_resource.select(fields)
end
without_resource() click to toggle source
# File lib/golden/setting/base.rb, line 14
def without_resource
  where(resource_type: nil, resource_id: nil)
end