# Squirrel and acts\_as\_rails

**URL:** <https://www.ruby-forum.com/t/squirrel-and-acts-as-rails/150037>\
**Category:** Rails\
**Created:** [October 2, 2008, 7:05pm UTC](https://www.ruby-forum.com/t/squirrel-and-acts-as-rails/150037 "2008-10-02T19:05:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ant](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/85e7bf/32.png) [@ant](https://www.ruby-forum.com/u/ant)\
**Post date:** [October 2, 2008, 7:05pm UTC](https://www.ruby-forum.com/t/squirrel-and-acts-as-rails/150037/1 "2008-10-02T19:05:42Z")

</div>

I have been using Squirrel ([thoughtbot case studies featuring design and development projects for websites, mobile and web applications.](http://thoughtbot.com/projects/squirrel))  
for performing rails searches. It really takes the thinking out of sql  
conditions and makes it so much more like normal ruby syntax.

I have recently been using the acts\_as\_tree gem([http://github.com/](http://github.com/)  
jcnetdev/acts\_as\_tree/tree/master) for a Group model that has  
children, grandchildren etc. Squirrel works well for the children and  
parent methods since these are normal associations but for methods  
like “ancestors” and “all\_children” which are recursive methods ,  
squirrel won’t work.

I don’t fully understand how squirrel uses associations. Can you think  
of a way that squirrel could be used in this kind of way

Group.find(:all) do  
ancestors.name.contains?(“Department”)  
end

Many thanks

Anthony
