Method: ActiveRecord::Querying#async_find_by_sql
- Defined in:
- activerecord/lib/active_record/querying.rb
#async_find_by_sql(sql, binds = [], preparable: nil, allow_retry: false, &block) ⇒ Object
Same as #find_by_sql
but perform the query asynchronously and returns an ActiveRecord::Promise.
59 60 61 62 63 64 65 |
# 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 |