diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 06312a66d..403f4a5ff 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -79,7 +79,7 @@ class ProjectsController < ApplicationController def show @custom_values = @project.custom_values.find(:all, :include => :custom_field) @members = @project.members.find(:all, :include => [:user, :role]) - @subprojects = @project.children if @project.children_count > 0 + @subprojects = @project.children if @project.children.size > 0 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC") @trackers = Tracker.find(:all) @open_issues_by_tracker = Issue.count(:group => :tracker, :joins => "INNER JOIN issue_statuses ON issue_statuses.id = issues.status_id", :conditions => ["project_id=? and issue_statuses.is_closed=?", @project.id, false]) diff --git a/app/models/project.rb b/app/models/project.rb index 7db061a62..e36100dcf 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -65,6 +65,6 @@ class Project < ActiveRecord::Base protected def validate errors.add(parent_id, " must be a root project") if parent and parent.parent - errors.add_to_base("A project with subprojects can't be a subproject") if parent and projects_count > 0 + errors.add_to_base("A project with subprojects can't be a subproject") if parent and children.size > 0 end end diff --git a/app/views/admin/projects.rhtml b/app/views/admin/projects.rhtml index b30cf2af5..cf7c06070 100644 --- a/app/views/admin/projects.rhtml +++ b/app/views/admin/projects.rhtml @@ -19,7 +19,7 @@