Class: Configuration
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Configuration
- Defined in:
- app/models/configuration.rb
Overview
This class is used to store configuration options in the back-end database. Each Configuraiton object has a :name and a :value. Some configuration parameters can be accessed through the helper methods provided in this class.
Class Method Summary (collapse)
- + (Boolean) exists?(*attrs)
-
+ (Object) increment_revision
Helper method to retrieve the value of the 'revision' setting and increment it by one.
-
+ (Object) password
Retrieves the current password (stored in the 'password' setting).
-
+ (Object) revision
Retrieve the value of the configuration setting whose name is 'revision'.
-
+ (Object) uploadsNode
Retrieve the name of the Node used to associate file uploads.
Class Method Details
+ (Boolean) exists?(*attrs)
8 9 10 |
# File 'app/models/configuration.rb', line 8 def Configuration.exists?(*attrs) self.table_exists? && super(*attrs) end |
+ (Object) increment_revision
Helper method to retrieve the value of the 'revision' setting and increment it by one.
19 20 21 22 23 |
# File 'app/models/configuration.rb', line 19 def Configuration.increment_revision revision = Configuration.find_by_name('revision') revision.value = revision.value.to_i + 1 revision.save end |
+ (Object) password
Retrieves the current password (stored in the 'password' setting)
26 27 28 |
# File 'app/models/configuration.rb', line 26 def Configuration.password Configuration.exists?(:name => 'password') ? Configuration.find_by_name('password').value : nil end |
+ (Object) revision
Retrieve the value of the configuration setting whose name is 'revision'
13 14 15 |
# File 'app/models/configuration.rb', line 13 def Configuration.revision Configuration.find_by_name('revision').value end |
+ (Object) uploadsNode
Retrieve the name of the Node used to associate file uploads.
31 32 33 |
# File 'app/models/configuration.rb', line 31 def Configuration.uploadsNode Configuration.find_by_name('uploads_node').value end |