Skip to content

Commit b6d61ee

Browse files
committed
Suppress DEPRECATION WARNING by setting ActiveRecord::Base.destroy_all_in_batches = true
This pull request suppresses these deprecation warnings. ``` $ bundle exec rspec spec/active_record/connection_adapters/oracle_enhanced/context_index_spec.rb ==> Loading config from ENV or use default ==> Running specs with ruby version 3.0.1 ==> Effective ActiveRecord version 7.0.0.alpha ..........DEPRECATION WARNING: As of Rails 7.1, destroy_all will no longer return the collection of objects that were destroyed. To transition to the new behaviour set the following in an initializer: Rails.application.config.active_record.destroy_all_in_batches = true (called from block (3 levels) in <top (required)> at /home/yahonda/src/github.com/rsim/oracle-enhanced/spec/active_record/connection_adapters/oracle_enhanced/context_index_spec.rb:209) .DEPRECATION WARNING: As of Rails 7.1, destroy_all will no longer return the collection of objects that were destroyed. To transition to the new behaviour set the following in an initializer: Rails.application.config.active_record.destroy_all_in_batches = true (called from block (3 levels) in <top (required)> at /home/yahonda/src/github.com/rsim/oracle-enhanced/spec/active_record/connection_adapters/oracle_enhanced/context_index_spec.rb:209) .DEPRECATION WARNING: As of Rails 7.1, destroy_all will no longer return the collection of objects that were destroyed. To transition to the new behaviour set the following in an initializer: Rails.application.config.active_record.destroy_all_in_batches = true (called from block (3 levels) in <top (required)> at /home/yahonda/src/github.com/rsim/oracle-enhanced/spec/active_record/connection_adapters/oracle_enhanced/context_index_spec.rb:209) ........... Finished in 32.32 seconds (files took 0.40705 seconds to load) 23 examples, 0 failures $ ``` Refer rails/rails#40445
1 parent 070b1f1 commit b6d61ee

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

spec/active_record/connection_adapters/oracle_enhanced/context_index_spec.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ class ::Post < ActiveRecord::Base
185185

186186
describe "on multiple tables" do
187187
before(:all) do
188+
@old_destroy_all_in_batches = ActiveRecord::Base.destroy_all_in_batches
189+
ActiveRecord::Base.destroy_all_in_batches = true
188190
@conn = ActiveRecord::Base.connection
189191
create_tables
190192
class ::Post < ActiveRecord::Base
@@ -201,6 +203,7 @@ class ::Comment < ActiveRecord::Base
201203
Object.send(:remove_const, "Comment")
202204
Object.send(:remove_const, "Post")
203205
ActiveRecord::Base.clear_cache!
206+
ActiveRecord::Base.destroy_all_in_batches = @old_destroy_all_in_batches
204207
end
205208

206209
after(:each) do

0 commit comments

Comments
 (0)