diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-01-10 10:34:57 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2013-01-10 10:34:57 +0100 |
commit | 70c436c52c76cf866b03fcab6bc43437c9490cd1 (patch) | |
tree | cf7dc1f98464d3893718be1900dd6a98437c41a5 /app/models | |
parent | b1fad77507c71402d25f085c048848462c2d52f1 (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.rb | 7 |
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' |