# Named\_scope returns Array -- find returns error?

**URL:** <https://www.ruby-forum.com/t/named-scope-returns-array-find-returns-error/191867>\
**Category:** Rails\
**Created:** [July 20, 2010, 12:35am UTC](https://www.ruby-forum.com/t/named-scope-returns-array-find-returns-error/191867 "2010-07-20T00:35:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sethwillits](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e0b2c6/32.png) [@sethwillits](https://www.ruby-forum.com/u/sethwillits)\
**Post date:** [July 20, 2010, 12:35am UTC](https://www.ruby-forum.com/t/named-scope-returns-array-find-returns-error/191867/1 "2010-07-20T00:35:09Z")

</div>

From the documentation:

* * *

class Shirt \< ActiveRecord::Base  
named\_scope :red, :conditions =\> {:color =\> ‘red’}  
end

## Unlike Shirt.find(…), however, the object returned by Shirt.red is not an Array; it resembles the association object constructed by a has\_many declaration. For instance, you can invoke Shirt.red.find(:first), Shirt.red.count, Shirt.red.find(:all, :conditions =\> {:size =\> â€˜smallâ€™})

So Shirt.red.find(:all, …) is valid according to the docs.

I have:

* * *

## class Member \< ActiveRecord::Base named\_scope :active\_members, :conditions =\> { :rcrd\_status =\> ‘Y’ } end

And wish to call:  
Member.active\_members.find(:all, :conditions =\> { … })

But I’m getting the error:

# ArgumentError (wrong number of arguments (2 for 1)): in `find’

And I noticed Member.active\_members.class.to\_s returns “Array”

What gives? I can’t imagine the documentation being _that_ wrong, so  
what did I do wrong?

---

<div class="post-metadata">

**Author:** ![sethwillits](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e0b2c6/32.png) [@sethwillits](https://www.ruby-forum.com/u/sethwillits)\
**Post date:** [July 20, 2010, 10:09am UTC](https://www.ruby-forum.com/t/named-scope-returns-array-find-returns-error/191867/2 "2010-07-20T10:09:28Z")

</div>

On 19 July 2010 23:35, Seth W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> declaration. For instance, you can invoke Shirt.red.find(:first),  
> class Member \< ActiveRecord::Base
> 
> # ArgumentError (wrong number of arguments (2 for 1)): in `find’

Can you show us the exact line that fails please with a few lines each  
side, with line numbers, and the trace dump?

What happens if you use active\_members without the find?

Colin

---

<div class="post-metadata">

**Author:** ![sethwillits](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e0b2c6/32.png) [@sethwillits](https://www.ruby-forum.com/u/sethwillits)\
**Post date:** [July 20, 2010, 7:55pm UTC](https://www.ruby-forum.com/t/named-scope-returns-array-find-returns-error/191867/3 "2010-07-20T19:55:44Z")

</div>

It’s a pity there’s no way to delete threads here. It turned out I had a  
class method with the same name. _slaps forehead_. Typical. Spend  
forever finding a bug, ask for help, find the answer yourself soon  
after! Sorry for the noise.
