I’ve been playing with a horrid method that I am using to sort my
Projects by the average importance of their tasks. it hits the
database quite a bit and is very ugly… does anyone have any
suggestions? rails is still very new to me.
here is my method.
priority = [ 5,4,3,2,1 ]
sorted = Array.new
priority.each do | current_priority |
find(:all).each do |project|
sorted << project if project.tasks.average(:priority) >=
current_priority && sorted.include?(project) == false