deprecated children_count replaced

git-svn-id: http://redmine.rubyforge.org/svn/trunk@188 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2007-01-26 20:34:09 +00:00
parent a9fc777b20
commit c38a2112c6
3 changed files with 3 additions and 3 deletions

View File

@ -79,7 +79,7 @@ class ProjectsController < ApplicationController
def show def show
@custom_values = @project.custom_values.find(:all, :include => :custom_field) @custom_values = @project.custom_values.find(:all, :include => :custom_field)
@members = @project.members.find(:all, :include => [:user, :role]) @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") @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "news.created_on DESC")
@trackers = Tracker.find(:all) @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]) @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])

View File

@ -65,6 +65,6 @@ class Project < ActiveRecord::Base
protected protected
def validate def validate
errors.add(parent_id, " must be a root project") if parent and parent.parent 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
end end

View File

@ -19,7 +19,7 @@
<td><%= link_to project.name, :controller => 'projects', :action => 'settings', :id => project %> <td><%= link_to project.name, :controller => 'projects', :action => 'settings', :id => project %>
<td><%=h project.description %> <td><%=h project.description %>
<td align="center"><%= image_tag 'true.png' if project.is_public? %> <td align="center"><%= image_tag 'true.png' if project.is_public? %>
<td align="center"><%= project.children_count %> <td align="center"><%= project.children.size %>
<td align="center"><%= format_date(project.created_on) %> <td align="center"><%= format_date(project.created_on) %>
<td align="center"> <td align="center">
<%= button_to l(:button_delete), { :controller => 'projects', :action => 'destroy', :id => project }, :class => "button-small" %> <%= button_to l(:button_delete), { :controller => 'projects', :action => 'destroy', :id => project }, :class => "button-small" %>