summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-10 10:34:57 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2013-01-10 10:34:57 +0100
commit70c436c52c76cf866b03fcab6bc43437c9490cd1 (patch)
treecf7dc1f98464d3893718be1900dd6a98437c41a5 /app/models
parentb1fad77507c71402d25f085c048848462c2d52f1 (diff)
GsParameter :entity, :section and :name can't be changed in the GUI any more.
Diffstat (limited to 'app/models')
-rw-r--r--app/models/gs_parameter.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/app/models/gs_parameter.rb b/app/models/gs_parameter.rb
index 520d07f..fe2a845 100644
--- a/app/models/gs_parameter.rb
+++ b/app/models/gs_parameter.rb
@@ -1,5 +1,6 @@
class GsParameter < ActiveRecord::Base
- attr_accessible :entity, :name, :section, :value, :class_type, :description
+ # https://github.com/rails/strong_parameters
+ include ActiveModel::ForbiddenAttributesProtection
validates :name,
:presence => true,
@@ -7,12 +8,12 @@ class GsParameter < ActiveRecord::Base
validates :class_type,
:presence => true,
- :inclusion => { :in => ['String', 'Integer', 'Boolean', 'YAML'] }
+ :inclusion => { :in => ['String', 'Integer', 'Boolean', 'YAML', 'Nil'] }
def self.get(wanted_variable)
if GsParameter.table_exists?
item = GsParameter.where(:name => wanted_variable).first
- if item.nil?
+ if item.nil? || item.class_type == 'Nil'
return nil
else
return item.value.to_i if item.class_type == 'Integer'