Skip to content

Commit 0b2fb5d

Browse files
authored
Merge pull request rails#49427 from koic/tweak_async_api_docs
Tweak the docs for `async_*` APIs [ci skip]
2 parents deb0869 + 0bdf160 commit 0b2fb5d

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

activerecord/lib/active_record/querying.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def find_by_sql(sql, binds = [], preparable: nil, &block)
5151
_load_from_sql(_query_by_sql(sql, binds, preparable: preparable), &block)
5252
end
5353

54-
# Same as <tt>#find_by_sql</tt> but perform the query asynchronously and returns an ActiveRecord::Promise
54+
# Same as <tt>#find_by_sql</tt> but perform the query asynchronously and returns an ActiveRecord::Promise.
5555
def async_find_by_sql(sql, binds = [], preparable: nil, &block)
5656
_query_by_sql(sql, binds, preparable: preparable, async: true).then do |result|
5757
_load_from_sql(result, &block)
@@ -102,7 +102,7 @@ def count_by_sql(sql)
102102
connection.select_value(sanitize_sql(sql), "#{name} Count").to_i
103103
end
104104

105-
# Same as <tt>#count_by_sql</tt> but perform the query asynchronously and returns an ActiveRecord::Promise
105+
# Same as <tt>#count_by_sql</tt> but perform the query asynchronously and returns an ActiveRecord::Promise.
106106
def async_count_by_sql(sql)
107107
connection.select_value(sanitize_sql(sql), "#{name} Count", async: true).then(&:to_i)
108108
end

activerecord/lib/active_record/relation/calculations.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def count(column_name = nil)
9393
end
9494
end
9595

96-
# Same as <tt>#count</tt> but perform the query asynchronously and returns an ActiveRecord::Promise
96+
# Same as <tt>#count</tt> but perform the query asynchronously and returns an ActiveRecord::Promise.
9797
def async_count(column_name = nil)
9898
async.count(column_name)
9999
end
@@ -106,7 +106,7 @@ def average(column_name)
106106
calculate(:average, column_name)
107107
end
108108

109-
# Same as <tt>#average</tt> but perform the query asynchronously and returns an ActiveRecord::Promise
109+
# Same as <tt>#average</tt> but perform the query asynchronously and returns an ActiveRecord::Promise.
110110
def async_average(column_name)
111111
async.average(column_name)
112112
end
@@ -120,7 +120,7 @@ def minimum(column_name)
120120
calculate(:minimum, column_name)
121121
end
122122

123-
# Same as <tt>#minimum</tt> but perform the query asynchronously and returns an ActiveRecord::Promise
123+
# Same as <tt>#minimum</tt> but perform the query asynchronously and returns an ActiveRecord::Promise.
124124
def async_minimum(column_name)
125125
async.minimum(column_name)
126126
end
@@ -134,7 +134,7 @@ def maximum(column_name)
134134
calculate(:maximum, column_name)
135135
end
136136

137-
# Same as <tt>#maximum</tt> but perform the query asynchronously and returns an ActiveRecord::Promise
137+
# Same as <tt>#maximum</tt> but perform the query asynchronously and returns an ActiveRecord::Promise.
138138
def async_maximum(column_name)
139139
async.maximum(column_name)
140140
end
@@ -152,7 +152,7 @@ def sum(initial_value_or_column = 0, &block)
152152
end
153153
end
154154

155-
# Same as <tt>#sum</tt> but perform the query asynchronously and returns an ActiveRecord::Promise
155+
# Same as <tt>#sum</tt> but perform the query asynchronously and returns an ActiveRecord::Promise.
156156
def async_sum(identity_or_column = nil)
157157
async.sum(identity_or_column)
158158
end
@@ -287,7 +287,7 @@ def pluck(*column_names)
287287
end
288288
end
289289

290-
# Same as <tt>#pluck</tt> but perform the query asynchronously and returns an ActiveRecord::Promise
290+
# Same as <tt>#pluck</tt> but perform the query asynchronously and returns an ActiveRecord::Promise.
291291
def async_pluck(*column_names)
292292
async.pluck(*column_names)
293293
end
@@ -315,7 +315,7 @@ def pick(*column_names)
315315
limit(1).pluck(*column_names).then(&:first)
316316
end
317317

318-
# Same as <tt>#pick</tt> but perform the query asynchronously and returns an ActiveRecord::Promise
318+
# Same as <tt>#pick</tt> but perform the query asynchronously and returns an ActiveRecord::Promise.
319319
def async_pick(*column_names)
320320
async.pick(*column_names)
321321
end
@@ -358,7 +358,7 @@ def ids
358358
result.then { |result| type_cast_pluck_values(result, columns) }
359359
end
360360

361-
# Same as <tt>#ids</tt> but perform the query asynchronously and returns an ActiveRecord::Promise
361+
# Same as <tt>#ids</tt> but perform the query asynchronously and returns an ActiveRecord::Promise.
362362
def async_ids
363363
async.ids
364364
end

0 commit comments

Comments
 (0)