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:in `send'' 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:in `retry_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:in `count'' 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:in `count'' 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! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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" <rockliu2009-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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:in `send'' > 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:in `retry_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:in `count'' > 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:in `count'' > 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! > > -- > You received this message because you are subscribed to the Google Groups"Ruby on Rails: Talk" group.> To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email torubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org> For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en.>-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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 Zdziech <rzdziech-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>> 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" <rockliu2009-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > 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:in `send'' > > 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:in `retry_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:in `count'' > > 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:in `count'' > > 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! > > > > -- > > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.