Class: SafePgMigrations::Helpers::BatchOver
- Inherits:
-
Object
- Object
- SafePgMigrations::Helpers::BatchOver
- Defined in:
- lib/safe-pg-migrations/helpers/batch_over.rb
Instance Method Summary collapse
- #each_batch ⇒ Object
-
#initialize(model, of: SafePgMigrations.config.backfill_batch_size) ⇒ BatchOver
constructor
A new instance of BatchOver.
Constructor Details
#initialize(model, of: SafePgMigrations.config.backfill_batch_size) ⇒ BatchOver
Returns a new instance of BatchOver.
6 7 8 9 10 11 |
# File 'lib/safe-pg-migrations/helpers/batch_over.rb', line 6 def initialize(model, of: SafePgMigrations.config.backfill_batch_size) @model = model @of = of @current_range = nil end |
Instance Method Details
#each_batch ⇒ Object
13 14 15 |
# File 'lib/safe-pg-migrations/helpers/batch_over.rb', line 13 def each_batch yield scope.where(primary_key => @current_range) while next_batch end |