Module: Sqlreport::ActiveRecordExtension::BatchMethods

Defined in:
lib/sqlreport/active_record_extension.rb

Overview

Provides batch processing functionality to ActiveRecord models

Instance Method Summary collapse

Instance Method Details

#sqlreport_batch(batch_size: 1000) ⇒ Object

Convert the relation to a SQLReport batch manager



22
23
24
25
26
27
28
# File 'lib/sqlreport/active_record_extension.rb', line 22

def sqlreport_batch(batch_size: 1000)
  # Get the SQL query from the relation
  sql = to_sql

  # Create a SQLReport batch manager from the query
  ::Sqlreport::BatchManager.new(sql, batch_size: batch_size)
end