aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/querying.rb
diff options
context:
space:
mode:
authorclaudiob <claudiob@gmail.com>2014-12-31 18:05:51 +0100
committerclaudiob <claudiob@gmail.com>2015-01-01 09:32:18 -0800
commitb095bf890f2e000baa2daec9b2d919598947b246 (patch)
tree487712f48781755827690c8e05db79e7c55d7dfd /activerecord/lib/active_record/querying.rb
parent8a950a5038ebfd00823e0266772f9fa29785d2aa (diff)
downloadrails-b095bf890f2e000baa2daec9b2d919598947b246.tar.gz
rails-b095bf890f2e000baa2daec9b2d919598947b246.tar.bz2
rails-b095bf890f2e000baa2daec9b2d919598947b246.zip
Fix doc formatting for `count_by_sql`
Before: ![before](https://cloud.githubusercontent.com/assets/10076/5592809/25ce08e8-9199-11e4-9dfe-5baa8bd6b658.png) After: ![after](https://cloud.githubusercontent.com/assets/10076/5592810/25ceef9c-9199-11e4-88f4-d286203d7f6f.png) [ci skip]
Diffstat (limited to 'activerecord/lib/active_record/querying.rb')
-rw-r--r--activerecord/lib/active_record/querying.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/querying.rb b/activerecord/lib/active_record/querying.rb
index e8de4db3a7..91c9a0db99 100644
--- a/activerecord/lib/active_record/querying.rb
+++ b/activerecord/lib/active_record/querying.rb
@@ -55,11 +55,12 @@ module ActiveRecord
# The use of this method should be restricted to complicated SQL queries that can't be executed
# using the ActiveRecord::Calculations class methods. Look into those before using this.
#
- # ==== Parameters
+ # Product.count_by_sql "SELECT COUNT(*) FROM sales s, customers c WHERE s.customer_id = c.id"
+ # # => 12
#
- # * +sql+ - An SQL statement which should return a count query from the database, see the example below.
+ # ==== Parameters
#
- # Product.count_by_sql "SELECT COUNT(*) FROM sales s, customers c WHERE s.customer_id = c.id"
+ # * +sql+ - An SQL statement which should return a count query from the database, see the example above.
def count_by_sql(sql)
sql = sanitize_conditions(sql)
connection.select_value(sql, "#{name} Count").to_i