Sha256: f04dee60f41e08d2cc75d29c4200c787d2a869890b3df44f2afbc314160dd5e3
Contents?: true
Size: 862 Bytes
Versions: 3
Compression:
Stored size: 862 Bytes
Contents
module Cambium class Setting < ActiveRecord::Base # ------------------------------------------ Plugins include PgSearch multisearchable :against => [:key, :value] has_paper_trail # ------------------------------------------ Validations validates :key, :presence => true, :uniqueness => true # ------------------------------------------ Scopes scope :alpha, -> { order(:key => :asc) } # ------------------------------------------ Class Methods def self.keys all.collect(&:key) end def self.method_missing(method, *arguments, &block) super rescue setting = self.find_by_key(method.to_s) return setting.value unless setting.nil? super end # ------------------------------------------ Instance Methods def to_s key.humanize.titleize end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cambium-1.3.2 | app/models/cambium/setting.rb |
cambium-1.3.1 | app/models/cambium/setting.rb |
cambium-1.3.0 | app/models/cambium/setting.rb |