From irb when I do:
Router.all(:email=>" blake@gmail.com ")
I get a list of all routers associated with this letter. But when I do this:
Router.count(:email=>" blake@gmail.com ")
I always get 0
I also looked at this question: Ruby Datamapper.count always returns 0 , but I still don't know why it doesn't work.
- Update # 1 -
Here is the result of the Router.all command. As you can see, I am returning the results.
1.9.3-p362 :003 > Router.all(:email=>" blake@gmail.com ") => [#<Router @id=8 @email=" blake@gmail.com " @hostname="router0">, #<Router @id=9 @email=" blake@gmail.com " @hostname="router0">, #<Router @id=10 @email=" blake@gmail.com " @hostname="router0">, #<Router @id=11 @email=" blake@gmail.com " @hostname="router0">, #<Router @id=13 @email=" blake@gmail.com " @hostname="router0">, #<Router @id=14 @email=" blake@gmail.com " @hostname="router0">, #<Router @id=15 @email=" blake@gmail.com " @hostname="router0">, #<Router @id=16 @email=" blake@gmail.com " @hostname="router0">]
But when I do Router.count as suggested, it still returns 0
1.9.3-p362 :004 > Router.count(:conditions => ["email = ?", " blake@gmail.com "]) => 0 1.9.3-p362 :005 > Router.count(:conditions => "email = ' blake@gmail.com '") => 0
source share