A slight modification to my last refactor: using singleton methods instead of a mix-in.

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@304 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2006-08-04 22:20:08 +00:00
parent c290d7a36a
commit 9158c4341c

View file

@ -21,19 +21,17 @@ class Todo < ActiveRecord::Base
:conditions => ['todos.user_id = ? and todos.done = ? and todos.completed is not null', user_id, true],
:order => 'todos.completed DESC',
:include => [ :project, :context ])
done.extend(CompletedToDosByDate)
def done.completed_within( date )
reject { |x| x.completed < date }
end
def done.completed_more_than( date )
reject { |x| x.completed > date }
end
done
end
end
module CompletedToDosByDate
def completed_within( date )
self.reject { |x| x.completed < date }
end
def completed_more_than( date )
self.reject { |x| x.completed > date }
end
end