This project is archived and is in readonly mode.
count before where fails
Reported by Darren Hinderer | June 9th, 2010 @ 05:29 PM
The active record querying rails guide gives this example of
querying:
Client.count.where("clients.first_name = 'Ryan' AND orders.status =
'received'").includes("orders")
However when I do that I get the error:
undefined method where' for Fixnum
Which means to me that it is doing the count before taking into account the where. I don't know if this is a bug or not. For now I'll just move my count method to after the where.
Comments and changes to this ticket
-
Neeraj Singh June 9th, 2010 @ 08:02 PM
I think the doc needs to be updated to reflect that "count" should be applied at the very end.
Could you please point out where in the doc you got what you referred to. Thanks.
-
Darren Hinderer June 9th, 2010 @ 09:31 PM
It is here, under Calculations:
http://github.com/lifo/docrails/blob/master/railties/guides/source/...
-
Rohit Arondekar June 13th, 2010 @ 11:09 AM
Fixed in this commit http://github.com/lifo/docrails/commit/b7a305f0cb7bf0cebc6f053b9faa...
Thank you for reporting the issue. And feel free to report any other problems you find in the guides. :)
-
Ryan Bigg June 14th, 2010 @ 10:06 AM
- State changed from new to resolved
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>