instance method async_find_by_sql

Ruby on Rails 8.1.2

Since v7.1.6

Available in: v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

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

sql req
binds opt = []
preparable key = nil
allow_retry key = false
block block
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

Type at least 2 characters to search.

↑↓ navigate · open · esc close