summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-12-05 15:02:29 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-12-05 15:02:29 +0000
commit3b6ba58b112e6d4026f17a43d8dd17a469d48ec8 (patch)
treea2af5cc9ab81084b2418e09eef96e7b4d29859b4 /app
parentca71cf380046d74d71e344da0dd85eed9de18f31 (diff)
downloadredmine-3b6ba58b112e6d4026f17a43d8dd17a469d48ec8.tar.gz
redmine-3b6ba58b112e6d4026f17a43d8dd17a469d48ec8.zip
Skip uniqueness validation when updating a setting without changing its name.
git-svn-id: http://svn.redmine.org/redmine/trunk@13720 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/setting.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/setting.rb b/app/models/setting.rb
index bc02d29ce..a16eede4e 100644
--- a/app/models/setting.rb
+++ b/app/models/setting.rb
@@ -77,7 +77,7 @@ class Setting < ActiveRecord::Base
cattr_accessor :available_settings
self.available_settings ||= {}
- validates_uniqueness_of :name
+ validates_uniqueness_of :name, :if => Proc.new {|setting| setting.new_record? || setting.name_changed?}
validates_inclusion_of :name, :in => Proc.new {available_settings.keys}
validates_numericality_of :value, :only_integer => true, :if => Proc.new { |setting|
(s = available_settings[setting.name]) && s['format'] == 'int'