When use mongoid , Model.count can't work

Hi, when i use mongoid to get the count of model named “User”, I met a
error :

irb(main):001:0> User.count

ArgumentError: wrong number of arguments (1 for 0)
from /var/lib/gems/1.8/gems/mongoid-2.0.2/lib/mongoid/
cursor.rb:37:in count' from /var/lib/gems/1.8/gems/mongoid-2.0.2/lib/mongoid/ cursor.rb:37:insend’
from /var/lib/gems/1.8/gems/mongoid-2.0.2/lib/mongoid/
cursor.rb:37:in count' from /var/lib/gems/1.8/gems/mongoid-2.0.2/lib/mongoid/ collections/retry.rb:29:inretry_on_connection_failure’
from /var/lib/gems/1.8/gems/mongoid-2.0.2/lib/mongoid/
cursor.rb:36:in count' from /var/lib/gems/1.8/gems/mongoid-2.0.2/lib/mongoid/contexts/ mongo.rb:73:incount’
from /var/lib/gems/1.8/gems/mongoid-2.0.2/lib/mongoid/
criteria.rb:48:in __send__' from /var/lib/gems/1.8/gems/mongoid-2.0.2/lib/mongoid/ criteria.rb:48:incount’
from /var/lib/gems/1.8/gems/mongoid-2.0.2/lib/mongoid/
finders.rb:34:in `count’
from (irb):2

version of mongoid is “2.0.2”
version of ruby is “1.8.7”
version of rails is “3.0.3”

Any suggestions/help?

Thanks!

Hi mate,

I can only advise you to update Ruby to 1.9.2 and rails to 3.0.9. You
should
have a look into rvm updater. You may want to try bundle install command
first.
On 4 Jul 2011 07:20, “Rock Liu” [email protected] wrote:

from /var/lib/gems/1.8/gems/mongoid-2.0.2/lib/mongoid/
criteria.rb:48:in `count’
Thanks!


You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

cc
Hi,Rafal ,your advice really helped me.I deleted the "mongo ,1.1.3 " in
my
Gemfile.it works.Thank u very much.
2011/7/4 Rafal Z. [email protected]