instance method
async_find_by_sql
Ruby on Rails 7.2.3
Since v7.1.6Signature
async_find_by_sql(sql, binds = [], preparable: nil, &block)
Same as #find_by_sql but perform the query asynchronously and returns an ActiveRecord::Promise.
Parameters
-
sqlreq -
bindsopt = [] -
preparablekey = nil -
blockblock
Source
# File activerecord/lib/active_record/querying.rb, line 59
def async_find_by_sql(sql, binds = [], preparable: nil, &block)
result = with_connection do |c|
_query_by_sql(c, sql, binds, preparable: preparable, async: true)
end
result.then do |result|
_load_from_sql(result, &block)
end
end
Defined in activerecord/lib/active_record/querying.rb line 59
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Querying