summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-05 12:50:17 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-05 12:50:17 +0100
commit6d809427f7dbff9509603cab3339c6fbda9ea992 (patch)
tree4f7e0c9d124364779f887032b4384264a589120d /app/models
parent01f2ab4e3d5694de81f6ebb594e0e852616ebbd9 (diff)
Add the initializer to set the constants.
Diffstat (limited to 'app/models')
-rw-r--r--app/models/gs_parameter.rb18
1 files changed, 9 insertions, 9 deletions
diff --git a/app/models/gs_parameter.rb b/app/models/gs_parameter.rb
index d0cc37a..aac10b0 100644
--- a/app/models/gs_parameter.rb
+++ b/app/models/gs_parameter.rb
@@ -10,19 +10,19 @@ class GsParameter < ActiveRecord::Base
:presence => true,
:inclusion => { :in => ['String', 'Integer', 'Boolean', 'YAML'] }
- def generate_contant
- Kernel.const_set(self.name, self.value.to_i) if self.class_type == 'Integer'
- Kernel.const_set(self.name, self.value.to_s) if self.class_type == 'String'
+ def generate_constant
+ Kernel.const_set(self.name, self.value.to_i) if self.class_type == 'Integer'
+ Kernel.const_set(self.name, self.value.to_s) if self.class_type == 'String'
- if self.class_type == 'Boolean'
- Kernel.const_set(self.name, true) if self.value == 'true'
- Kernel.const_set(self.name, false) if self.value == 'false'
- end
+ if self.class_type == 'Boolean'
+ Kernel.const_set(self.name, true) if self.value == 'true'
+ Kernel.const_set(self.name, false) if self.value == 'false'
+ end
- Kernel.const_set(self.name, YAML.load(self.value)) if self.class_type == 'YAML'
+ Kernel.const_set(self.name, YAML.load(self.value)) if self.class_type == 'YAML'
end
def to_s
- name
+ name
end
end