mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-24 01:11:12 +00:00
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
This commit is contained in:
parent
ca71cf3800
commit
3b6ba58b11
@ -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'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user