# Betternestedset question

**URL:** <https://www.ruby-forum.com/t/betternestedset-question/137169>\
**Category:** Rails\
**Created:** [May 9, 2008, 5:03pm UTC](https://www.ruby-forum.com/t/betternestedset-question/137169 "2008-05-09T17:03:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![apswartz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71e660/32.png) [@apswartz](https://www.ruby-forum.com/u/apswartz)\
**Post date:** [May 9, 2008, 5:03pm UTC](https://www.ruby-forum.com/t/betternestedset-question/137169/1 "2008-05-09T17:03:19Z")

</div>

To help myself learn ruby and rails, I am implementing a todo list  
manager. Every task can have sub tasks (and so on.)

I am using betternestedset

Until this point, I have been getting everything and then only  
displaying if it is not done OR it has been updated in the last day.  
(If you don’t display a parent, you don’t display any of its  
children.)

However, it seems to me that this should be done in the getting of  
data instead of the displaying of it.

I can do this for the root trees:  
`
one_day_old = Date.today - 1`

```
find(:all, :conditions => "(user_id = #{user.id}) AND
                              ((done = 'f') OR (updated_at >=

```

‘#{one\_day\_old}’)) AND  
((parent\_id IS NULL) OR (parent\_id =  
0))", :order =\> “lft”)

However, then when I query the children I still get ones that I don’t  
want to show.

It looks like full\_set with the exclude string may be the right way to  
go, but I can’t quite figure it out. (Or if there is a more “rails-y”  
way to go about this…)

Any suggestions?

–Alan
