Added number of notes to project listing page. Fixes #128.

Interested in feedback on this... Which is higher value: the simplicity of only showing the number of actions or the utility of showing the number of notes as well?
 


git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@485 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2007-03-25 04:26:39 +00:00
parent 8dba728577
commit 5d63400fca
3 changed files with 14 additions and 1 deletions

View file

@ -136,6 +136,13 @@ class ProjectsController < ApplicationController
@active_projects = @projects.select{ |p| p.active? }
@hidden_projects = @projects.select{ |p| p.hidden? }
@completed_projects = @projects.select{ |p| p.completed? }
project_note_counts = Note.count(:group => 'project_id')
@projects.each do |project|
#define a singlton method "notes_count" on each project object
class << project; self end.send(:define_method, :notes_count) do
project_note_counts[project.id] || 0
end
end
@new_project = @user.projects.build
render
end