Class: AppConfig

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/app_config.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.[](name) ⇒ Object



7
8
9
10
11
12
13
# File 'app/models/app_config.rb', line 7

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

.currentObject



15
16
17
# File 'app/models/app_config.rb', line 15

def self.current
  @current ||= AppConfig.all
end

Instance Method Details

#reloadObject



18
19
20
# File 'app/models/app_config.rb', line 18

def reload
  AppConfig.instance_variable_set '@current', nil
end

#set_nameObject



22
23
24
# File 'app/models/app_config.rb', line 22

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