Tom A. wrote:
OK, try pasting the following into your Todo_list model (todo_list.rb)
at the top
:class_name => ‘Todo_item’,
:conditions => ‘done is not null’
if self.todo_items == self.completed_items
Then you’ll find that Todo_list.completed? should return ‘true’ if all
the items are completed, and false if not. So now you can seperate out
completed and uncompleted lists
I think that’ll work, anyhow. If it does, do you understand why?
(Hope you didn’t think I was condescending last time).
Thanks for the help. It is very similar to what I have in the model
todo_items.each do |todoitem|
return false if not taskitem.done?
What I was trying to do was get a has of each like this:
@active_lists = TodoList.find(:all,
@completed_lists = TodoList.find(:all,
The only way I can guess to do it it to return all the todolists then
ittterate over them one by one and add them to an 2 new arrays. Seems a
little complex. I need two variables because of the way the view is
listing them out.