Hi everyone!
I want to show in a view the tasks for a day in concrete (today). these tasks have an estimated time that must sum 6 hours per day.
in the model I have this method:
def self.tasks_for_today
total_time = 0
r = Array.new
all(:conditions => "finished = 0").each do | t |
total_time += t.estimated_time
r << t if total_time <= 6
end
r
end
and works fine, but I need the "r" variable to be a instance of a Tasks model, not a instance of Array class...
How can I do that?