I'm looking for a clean way to filter the children of a parent in a has\_many relationship without hitting the database and thus reloading the db's view of the objects back into the app.

For example:

```
class Parent < ActiveRecord::Base
  has_many :children, ...
  ...
end

```

My understanding (correct me if I'm wrong) is that 

```
parent.children.find_all_by_attr('foo')

```

returns all the parent's children that have a attr value of 'foo' in the db but because it hits the database again, any children that have had their attr values set to foo before being saved will have their db values restored thus overwriting any changes.

I've hacked around this with

```
parent.children.reject { |child| child.attr != 'foo' }

```

but this seems very sloppy and more difficult to read. Does anybody have a cleaner suggestion on how to do this?