instance method
async_count_by_sql
Ruby on Rails edge
Since v7.1.6Signature
async_count_by_sql(sql)
Same as #count_by_sql but perform the query asynchronously and returns an ActiveRecord::Promise.
Parameters
-
sqlreq
Source
# File activerecord/lib/active_record/querying.rb, line 139
def async_count_by_sql(sql)
with_connection do |c|
_async_select_all(c, _sql_for_find(sql), "#{name} Count").then do |result|
result.rows.first&.first.to_i
end
end
end
Defined in activerecord/lib/active_record/querying.rb line 139
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Querying