# Find.all Question

**URL:** <https://www.ruby-forum.com/t/find-all-question/125495>\
**Category:** Rails\
**Created:** [January 9, 2008, 5:24pm UTC](https://www.ruby-forum.com/t/find-all-question/125495 "2008-01-09T17:24:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![joep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/87869e/32.png) [@joep](https://www.ruby-forum.com/u/joep)\
**Post date:** [January 9, 2008, 5:24pm UTC](https://www.ruby-forum.com/t/find-all-question/125495/1 "2008-01-09T17:24:26Z")

</div>

Hi,

I’ve heard that it’s preferred not to use Model\_Name.find(:all,  
:conditions =\> [“blah = 2”]  
And that using something like Model\_Name.find\_by\_blah(2) is better.

If that’s the case, how would I do this?

@all\_apples = Apple.find(:all, :conditions =\> [“flavor != 1”])

Can I do something like  
Apple.find\_all\_by\_flavor(!1)

Any help on this is appreciated.

---

<div class="post-metadata">

**Author:** ![joep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/87869e/32.png) [@joep](https://www.ruby-forum.com/u/joep)\
**Post date:** [January 9, 2008, 5:49pm UTC](https://www.ruby-forum.com/t/find-all-question/125495/2 "2008-01-09T17:49:41Z")

</div>

Thanks, Fred.

---

<div class="post-metadata">

**Author:** ![joep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/87869e/32.png) [@joep](https://www.ruby-forum.com/u/joep)\
**Post date:** [January 10, 2008, 12:23am UTC](https://www.ruby-forum.com/t/find-all-question/125495/3 "2008-01-10T00:23:11Z")

</div>

If flavor were a boolean field you could do

Apple.find\_by\_flavor(false)

On Jan 10, 2008 3:19 AM, Joe P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> ## Thanks, Fred.
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> >

–  
Ryan B.

> **[frozenplague.net](http://www.frozenplague.net)**
>
> This domain may be for sale!

Feel free to add me to MSN and/or GTalk as this email.

---

<div class="post-metadata">

**Author:** ![joep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/87869e/32.png) [@joep](https://www.ruby-forum.com/u/joep)\
**Post date:** [January 9, 2008, 5:35pm UTC](https://www.ruby-forum.com/t/find-all-question/125495/4 "2008-01-09T17:35:06Z")

</div>

On 9 Jan 2008, at 16:24, Joe P. wrote:

> Hi,
> 
> I’ve heard that it’s preferred not to use Model\_Name.find(:all,  
> :conditions =\> [“blah = 2”]  
> And that using something like Model\_Name.find\_by\_blah(2) is better.

In a complete void of information, the only better thing is  
readability (and that should be Model\_Name.find\_all\_by\_blah(2))

> If that’s the case, how would I do this?
> 
> @all\_apples = Apple.find(:all, :conditions =\> [“flavor != 1”])
> 
> Can I do something like  
> Apple.find\_all\_by\_flavor(!1)

You can’t. You just have to write it out in full.

Fred
