diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-10-09 06:36:58 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-10-09 06:36:58 +0000 |
commit | 46b877296a71bee4f5c6cf4d62a5bfa56476b848 (patch) | |
tree | 64ecb561216e84217e75424e333c06cec87d1d41 /app | |
parent | d690cff576c3083ca75b7f3b7c177b0c65e8e0ff (diff) | |
download | redmine-46b877296a71bee4f5c6cf4d62a5bfa56476b848.tar.gz redmine-46b877296a71bee4f5c6cf4d62a5bfa56476b848.zip |
Merged r14619 (#20282).
git-svn-id: http://svn.redmine.org/redmine/branches/3.1-stable@14649 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/models/project.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index aacb01c15..e30fc9fda 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -687,12 +687,14 @@ class Project < ActiveRecord::Base attrs = attrs.deep_dup @unallowed_parent_id = nil - parent_id_param = attrs['parent_id'].to_s - if parent_id_param.blank? || parent_id_param != parent_id.to_s - p = parent_id_param.present? ? Project.find_by_id(parent_id_param) : nil - unless allowed_parents(user).include?(p) - attrs.delete('parent_id') - @unallowed_parent_id = true + if new_record? || attrs.key?('parent_id') + parent_id_param = attrs['parent_id'].to_s + if new_record? || parent_id_param != parent_id.to_s + p = parent_id_param.present? ? Project.find_by_id(parent_id_param) : nil + unless allowed_parents(user).include?(p) + attrs.delete('parent_id') + @unallowed_parent_id = true + end end end |