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
Fix ActiveRecord::ConnectionAdapters::QueryCache#dirties_query_cache #41147
Fix ActiveRecord::ConnectionAdapters::QueryCache#dirties_query_cache #41147
Conversation
|
||
assert_equal count + 1, Event.count | ||
ensure | ||
Event.find(1)&.destroy |
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 you use reset_fixtures("posts")
and Post
model instead?
Event.find(1)&.destroy | |
reset_fixtures("posts") |
https://buildkite.com/rails/rails/builds/74129#3b2b1120-8262-4d6a-87b4-d6649ee9155d/1070-1079
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.
Or, use the returning value for create
(id = @connection.create(...)
).
Event.find(1)&.destroy | |
Event.find(id).destroy if id |
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.
Done
@connection.enable_query_cache! | ||
|
||
count = Event.count | ||
binds = [[Event.column_for_attribute("id"), 1]] |
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.
Don't use the deprecated legacy binds (an array of [column || nil, value]
).
https://buildkite.com/rails/rails/builds/74129#f336c8d3-da13-4408-8e86-cedecdabba7d/1066-1075
binds = [[Event.column_for_attribute("id"), 1]] | |
binds = [1] |
f2d018d
to
6162ce3
Compare
binds = ["", ""] | ||
bind_param = Arel::Nodes::BindParam.new(nil) |
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 you remove unused variables?
binds = ["", ""] | |
bind_param = Arel::Nodes::BindParam.new(nil) |
https://github.com/rails/rails/pull/41147/checks?check_run_id=1716707664
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.
Done
6162ce3
to
79d5712
Compare
@kamipo Thank you for your review and suggestions. |
Thanks! |
…_after_perform_created Fix ActiveRecord::ConnectionAdapters::QueryCache#dirties_query_cache
Summary
In the active_record/connection_adapters/abstract/database_statements.rb file,
#create
method is alias of#insert
method.In the active_record/connection_adapters/abstract/query_cache.rb file,
#create
method is not cleanup query cache.We should override
#create
method cleanup query cache too.