3 # The Radiant::Config object emulates a hash with simple bracket methods
4 # which allow you to get and set values in the configuration table:
6 # Radiant::Config['setting.name'] = 'value'
7 # Radiant::Config['setting.name'] #=> "value"
9 # Currently, there is not a way to edit configuration through the admin
10 # system so it must be done manually. The console script is probably the
11 # easiest way to this:
13 # % script/console production
14 # Loading production environment.
15 # >> Radiant::Config['setting.name'] = 'value'
19 # Radiant currently uses the following settings:
21 # admin.title :: the title of the admin system
22 # admin.subtitle :: the subtitle of the admin system
23 # defaults.page.parts :: a comma separated list of default page parts
24 # defaults.page.status :: a string representation of the default page status
25 # dev.host :: the hostname where draft pages are viewable
26 # local.timezone :: the timezone offset (using a String or integer
27 # from http://api.rubyonrails.org/classes/TimeZone.html)
28 # used to correct displayed times
29 class Config < ActiveRecord::Base
30 set_table_name "config"
34 pair = find_by_key(key)
35 pair.value unless pair.nil?
39 pair = find_by_key(key)
42 pair.key, pair.value = key, value
52 Hash[ *find(:all).map { |pair| [pair.key, pair.value] }.flatten ]
57 write_attribute :value, param.to_s
62 read_attribute(:value) == "true"
64 read_attribute(:value)