Sha256: 7912d6452df28f30bbe30777af3ea5456cb2614313f0a20653d4988349215df3

Contents?: true

Size: 487 Bytes

Versions: 25

Compression:

Stored size: 487 Bytes

Contents

class AppConfig < ActiveRecord::Base
  has_many :sitemaps, :as=>:resource
  after_save :reload

  before_create :set_name

  def self.[](name)
    val = select{|t| t.name==name}[0].try(:value)
    if val && (val==val.to_i.to_s)
      val = val.to_i
    end
    val
  end

  def self.current
    @current ||= AppConfig.all
  end
  def reload
    AppConfig.instance_variable_set '@current', nil
  end

  def set_name
    self.name = sitemaps[0].try(:menu_text) unless self.name
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
wheels-0.1.30 app/models/app_config.rb
wheels-0.1.28 app/models/app_config.rb
wheels-0.1.27 app/models/app_config.rb
wheels-0.1.25 app/models/app_config.rb
wheels-0.1.24 app/models/app_config.rb
wheels-0.1.23 app/models/app_config.rb
wheels-0.1.22 app/models/app_config.rb
wheels-0.1.21 app/models/app_config.rb
wheels-0.1.20 app/models/app_config.rb
wheels-0.1.19 app/models/app_config.rb
wheels-0.1.18 app/models/app_config.rb
wheels-0.1.17 app/models/app_config.rb
wheels-0.1.16 app/models/app_config.rb
wheels-0.1.15 app/models/app_config.rb
wheels-0.1.14 app/models/app_config.rb
wheels-0.1.13 app/models/app_config.rb
wheels-0.1.12 app/models/app_config.rb
wheels-0.1.10 app/models/app_config.rb
wheels-0.1.9 app/models/app_config.rb
wheels-0.1.8 app/models/app_config.rb