]> source.dussan.org Git - redmine.git/commitdiff
Use scope.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 2 Dec 2014 20:23:20 +0000 (20:23 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 2 Dec 2014 20:23:20 +0000 (20:23 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@13692 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/project.rb

index c21f6ef7e6cfd07a232fac8ebf788942134541b4..7df728b3c48e57ef7f3887314811a401683e6ff2 100644 (file)
@@ -368,7 +368,7 @@ class Project < ActiveRecord::Base
   # by the current user
   def allowed_parents
     return @allowed_parents if @allowed_parents
-    @allowed_parents = Project.where(Project.allowed_to_condition(User.current, :add_subprojects)).to_a
+    @allowed_parents = Project.allowed_to(User.current, :add_subprojects).to_a
     @allowed_parents = @allowed_parents - self_and_descendants
     if User.current.allowed_to?(:add_project, nil, :global => true) || (!new_record? && parent.nil?)
       @allowed_parents << nil