instance method
async_find_by_sql
Ruby on Rails edge
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 75
def async_find_by_sql(sql, binds = [], preparable: nil, allow_retry: false, &block)
with_connection do |c|
_async_select_all(c, _sql_for_find(sql), "#{name} Load", binds, preparable: preparable, allow_retry: allow_retry)
end.then do |result|
_load_from_sql(result, &block)
end
end
Defined in activerecord/lib/active_record/querying.rb line 75
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Querying