mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #44309 from nholden/fix-destroy-async-config
Fix `config.active_record.destroy_association_async_job` configuration
This commit is contained in:
commit
0dbe699d5c
3 changed files with 26 additions and 1 deletions
|
@ -43,7 +43,7 @@ module ActiveJob
|
|||
end
|
||||
|
||||
ActiveSupport.on_load(:active_record) do
|
||||
self.destroy_association_async_job = ActiveRecord::DestroyAssociationAsyncJob
|
||||
self.destroy_association_async_job ||= ActiveRecord::DestroyAssociationAsyncJob
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
* Fix `config.active_record.destroy_association_async_job` configuration
|
||||
|
||||
`config.active_record.destroy_association_async_job` should allow
|
||||
applications to specify the job that will be used to destroy associated
|
||||
records in the background for `has_many` associations with the
|
||||
`dependent: :destroy_async` option. Previously, that was ignored, which
|
||||
meant the default `ActiveRecord::DestroyAssociationAsyncJob` always
|
||||
destroyed records in the background.
|
||||
|
||||
*Nick Holden*
|
||||
|
||||
* Fix quoting of `ActiveSupport::Duration` and `Rational` numbers in the MySQL adapter.
|
||||
|
||||
*Kevin McPhillips*
|
||||
|
|
|
@ -2444,6 +2444,20 @@ module ApplicationTests
|
|||
assert_equal ActiveRecord::DestroyAssociationAsyncJob, ActiveRecord::Base.destroy_association_async_job
|
||||
end
|
||||
|
||||
test "ActiveRecord::Base.destroy_association_async_job can be configured via config.active_record.destroy_association_job" do
|
||||
class ::DummyDestroyAssociationAsyncJob; end
|
||||
|
||||
app_file "config/environments/test.rb", <<-RUBY
|
||||
Rails.application.configure do
|
||||
config.active_record.destroy_association_async_job = DummyDestroyAssociationAsyncJob
|
||||
end
|
||||
RUBY
|
||||
|
||||
app "test"
|
||||
|
||||
assert_equal DummyDestroyAssociationAsyncJob, ActiveRecord::Base.destroy_association_async_job
|
||||
end
|
||||
|
||||
test "ActionView::Helpers::FormTagHelper.default_enforce_utf8 is false by default" do
|
||||
app "development"
|
||||
assert_equal false, ActionView::Helpers::FormTagHelper.default_enforce_utf8
|
||||
|
|
Loading…
Reference in a new issue