diff options
author | Rohit Arondekar <rohit.arondekar@gmail.com> | 2010-06-13 03:05:56 -0700 |
---|---|---|
committer | Rohit Arondekar <rohit.arondekar@gmail.com> | 2010-06-13 03:05:56 -0700 |
commit | b7a305f0cb7bf0cebc6f053b9faa45433809ce0d (patch) | |
tree | a15ced34200a254539d710446587ccff73ecd1e5 /railties | |
parent | 27f337d54faa72a4d14f26fbfa5b0a1d5c28d44c (diff) | |
download | rails-b7a305f0cb7bf0cebc6f053b9faa45433809ce0d.tar.gz rails-b7a305f0cb7bf0cebc6f053b9faa45433809ce0d.tar.bz2 rails-b7a305f0cb7bf0cebc6f053b9faa45433809ce0d.zip |
Rails Guides: AR Querying, .count should be at the end as it returns a number. [#4811 state:resolved]
Diffstat (limited to 'railties')
-rw-r--r-- | railties/guides/source/active_record_querying.textile | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/railties/guides/source/active_record_querying.textile b/railties/guides/source/active_record_querying.textile index e18dbc9c42..6e7ff6d5e0 100644 --- a/railties/guides/source/active_record_querying.textile +++ b/railties/guides/source/active_record_querying.textile @@ -869,7 +869,7 @@ SELECT count(*) AS count_all FROM clients WHERE (first_name = 'Ryan') You can also use the +includes+ or +joins+ methods for this to do something a little more complex: <ruby> -Client.count.where("clients.first_name = 'Ryan' AND orders.status = 'received'").includes("orders") +Client.where("clients.first_name = 'Ryan' AND orders.status = 'received'").includes("orders").count </ruby> Which will execute: |