diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index abe8d56cb8f..57af3d5af77 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -7,10 +7,6 @@ *Rafael Mendonça França* -* Remove deprecated `ActiveSupport::Notifications::Event#children` and `ActiveSupport::Notifications::Event#parent_of?`. - - *Rafael Mendonça França* - * Remove implicit conversion of objects into `String` by `ActiveSupport::SafeBuffer`. *Rafael Mendonça França* diff --git a/activesupport/lib/active_support/notifications/instrumenter.rb b/activesupport/lib/active_support/notifications/instrumenter.rb index eefca19b191..a6f83e88d11 100644 --- a/activesupport/lib/active_support/notifications/instrumenter.rb +++ b/activesupport/lib/active_support/notifications/instrumenter.rb @@ -165,6 +165,23 @@ module ActiveSupport @allocation_count_finish - @allocation_count_start end + def children # :nodoc: + ActiveSupport.deprecator.warn <<~EOM + ActiveSupport::Notifications::Event#children is deprecated and will + be removed in Rails 7.2. + EOM + [] + end + + def parent_of?(event) # :nodoc: + ActiveSupport.deprecator.warn <<~EOM + ActiveSupport::Notifications::Event#parent_of? is deprecated and will + be removed in Rails 7.2. + EOM + start = (time - event.time) * 1000 + start <= 0 && (start + duration >= event.duration) + end + # Returns the difference in milliseconds between when the execution of the # event started and when it ended. # diff --git a/guides/source/7_1_release_notes.md b/guides/source/7_1_release_notes.md index 5994c70594b..9f53a5c55e9 100644 --- a/guides/source/7_1_release_notes.md +++ b/guides/source/7_1_release_notes.md @@ -166,8 +166,6 @@ Please refer to the [Changelog][active-support] for detailed changes. * Remove implicit conversion of objects into `String` by `ActiveSupport::SafeBuffer`. -* Remove deprecated `ActiveSupport::Notifications::Event#children` and `ActiveSupport::Notifications::Event#parent_of?`. - * Remove deprecated support to generate incorrect RFC 4122 UUIDs when providing a namespace ID that is not one of the constants defined on `Digest::UUID`.