Betternestedset question

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

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 = - 1

find(:all, :conditions => "(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?


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs