Hello,
I’m having a problem with the built-in all scope. For example in my
Subscription model,
Subscription.all.count
NoMethodError: undefined method `count’ for #Array:0xb5dce7f8
from (irb):46
from :0
However, my own version of all defined in the model simply as
“named_scope :everything” works fine
Subscription.everything.count
=> 849
I also cannot chain scopes onto all
Subscription.all.active.count
NoMethodError: undefined method `active’ for #Array:0xb5a80268
from (irb):50
from :0
But
Subscription.everything.active.count
=> 611
I’m relatively new to Rails so any insights people can give would be
greatly appreciated. Thanks!
My environment is
[[email protected] trunk]# gem -v
1.1.1
[[email protected] trunk]# gem list
*** LOCAL GEMS ***
actionmailer (2.1.0)
actionpack (2.1.0)
activerecord (2.1.0)
activeresource (2.1.0)
activesupport (2.1.0)
mysql (2.7)
piston (1.4.0)
rails (2.1.0)
rake (0.8.1)
[[email protected] trunk]# cat /etc/issue
CentOS release 5.2 (Final)
Kernel \r on an \m
[[email protected] trunk]# uname -a
Linux localhost.localdomain 2.6.18-92.1.6.el5 #1 SMP Wed Jun 25
13:49:24 EDT 2008 i686 i686 i386 GNU/Linux