Find.all Question

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.

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

Thanks, Fred.

If flavor were a boolean field you could do

Apple.find_by_flavor(false)