Skip to content
This repository
Browse code

Rails Guides: AR Querying, .count should be at the end as it returns …

…a number. [#4811 state:resolved]
  • Loading branch information...
commit b7a305f0cb7bf0cebc6f053b9faa45433809ce0d 1 parent 27f337d
Rohit Arondekar authored June 13, 2010
2  railties/guides/source/active_record_querying.textile
Source Rendered
@@ -869,7 +869,7 @@ SELECT count(*) AS count_all FROM clients WHERE (first_name = 'Ryan')
869 869
 You can also use the +includes+ or +joins+ methods for this to do something a little more complex:
870 870
 
871 871
 <ruby>
872  
-Client.count.where("clients.first_name = 'Ryan' AND orders.status = 'received'").includes("orders")
  872
+Client.where("clients.first_name = 'Ryan' AND orders.status = 'received'").includes("orders").count
873 873
 </ruby>
874 874
 
875 875
 Which will execute:

0 notes on commit b7a305f

Please sign in to comment.
Something went wrong with that request. Please try again.