-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move NoTouching
down the inheritance chain on AR::Base
#14842
Conversation
|
||
DeveloperWithTouchCallback.no_touching do | ||
developer.touch | ||
assert !developer.after_touch_called |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert_not
Looks good. Please include a CHANGELOG entry and I'll merge |
@@ -170,6 +170,15 @@ def test_no_touching_threadsafe | |||
assert !@developer.no_touching? | |||
end | |||
|
|||
def test_no_touching_with_callbacks | |||
developer = DeveloperWithTouchCallback.first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we define DeveloperWithTouchCallback
inside this test case?
dev_with_touch_callback = Class.new(ActiveRecord::Base)
# ...
end
This will keep the context together and not increase the global models count any further.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me. @rafaelfranca thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
…t empty transactions. Closes #14841.
@senny @rafaelfranca PR updated 👍 |
Move `NoTouching` down the inheritance chain on AR::Base
@lucasmazza thanks 💛 |
Move `NoTouching` down the inheritance chain on AR::Base Conflicts: activerecord/test/cases/timestamp_test.rb
This way the
no_touching
blocks won't trigger anytouch
related callbacks and won't create empty transactions (since it is included after theTransactions
module).Fixes #14841.