summaryrefslogtreecommitdiffstats
path: root/app/models/role.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-01-07 22:51:45 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-01-07 22:51:45 +0000
commit0eda7765fa55eee98646152278b7ef976f49e7c8 (patch)
tree50795c7bd31c10bb9326316a219c8b1512653eec /app/models/role.rb
parente98e7c8c434d97a45dc1d9fb377eae00acd9b8bc (diff)
downloadredmine-0eda7765fa55eee98646152278b7ef976f49e7c8.tar.gz
redmine-0eda7765fa55eee98646152278b7ef976f49e7c8.zip
Skip validation if attribute did not change.
git-svn-id: http://svn.redmine.org/redmine/trunk@13851 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/role.rb')
-rw-r--r--app/models/role.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/models/role.rb b/app/models/role.rb
index 2db77a1a0..87fb1f6ad 100644
--- a/app/models/role.rb
+++ b/app/models/role.rb
@@ -71,10 +71,10 @@ class Role < ActiveRecord::Base
validates_length_of :name, :maximum => 30
validates_inclusion_of :issues_visibility,
:in => ISSUES_VISIBILITY_OPTIONS.collect(&:first),
- :if => lambda {|role| role.respond_to?(:issues_visibility)}
+ :if => lambda {|role| role.respond_to?(:issues_visibility) && role.issues_visibility_changed?}
validates_inclusion_of :users_visibility,
:in => USERS_VISIBILITY_OPTIONS.collect(&:first),
- :if => lambda {|role| role.respond_to?(:users_visibility)}
+ :if => lambda {|role| role.respond_to?(:users_visibility) && role.users_visibility_changed?}
# Copies attributes from another role, arg can be an id or a Role
def copy_from(arg, options={})