instance method
async_find_by_sql
Ruby on Rails 8.1.2
Since v7.1.6Signature
async_find_by_sql(sql, binds = [], preparable: nil, allow_retry: false, &block)
Same as #find_by_sql but perform the query asynchronously and returns an ActiveRecord::Promise.
Parameters
-
sqlreq -
bindsopt = [] -
preparablekey = nil -
allow_retrykey = false -
blockblock
Source
# File activerecord/lib/active_record/querying.rb, line 59
def async_find_by_sql(sql, binds = [], preparable: nil, allow_retry: false, &block)
with_connection do |c|
_query_by_sql(c, sql, binds, preparable: preparable, allow_retry: allow_retry, async: true)
end.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