-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #397 from zzak/twir-2024-11-22
twir-2024-11-22
- Loading branch information
Showing
1 changed file
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
layout: post | ||
title: "Active Support's NotificationAssertions and `sql.active_record` gets `affected_rows`" | ||
categories: news | ||
author: zzak | ||
og_image: assets/images/this-week-in-rails.png | ||
published: true | ||
date: 2024-11-22 | ||
--- | ||
|
||
|
||
Hi, it's [zzak](https://github.com/zzak). Let's explore this week's changes in the Rails codebase. | ||
|
||
[Add Active Support Notifications test helper module](https://github.com/rails/rails/pull/53065) | ||
This PR has been created because it's currently cumbersome to test that a certain code block/action triggers an `ActiveSupport::Notifications::Event` to be emitted. It would be ideal to have some helpers to `assert` against such event emission. Have heard such helpers could be helpful internal to Rails as well. | ||
|
||
[Add "affected_rows" to "sql.active_record" event](https://github.com/rails/rails/pull/53277) | ||
The [recently added][1] `row_count` value is very useful for identifying cases where a query would return a large result set as large results can end up using a lot of memory or even be blocked by databases like Vitess. | ||
However, somewhere that `row_count` falls short is for queries that do not necessarily return their results back to the client. These queries that affect too many rows can lead to their own set of problems, such as overwhelming replication and causing replication lag. | ||
|
||
[Allow "hidden_field" tag to accept a custom autocomplete value](https://github.com/rails/rails/pull/53512) | ||
In [#43280](https://github.com/rails/rails/pull/43280) `autocomplete="off"` was enforced for all hidden inputs generated by Rails to fix a [firefox bug](https://bugzilla.mozilla.org/show_bug.cgi?id=520561). | ||
Unfortunately it's also a legitimate use-case to specify an `autocomplete` with a value such as `username` and a value on a hidden input. This hints to the browser that (in this example) the username of a password reset form is what we've provided as the value and the password manager can store it as such. | ||
|
||
[Allow to reset cache counters for multiple records](https://github.com/rails/rails/pull/44971) | ||
There is often a need to reset counter caches for multiple records. Achieving this before will generate many extra queries. | ||
|
||
[Allow setting content type with a symbol of the Mime Type](https://github.com/rails/rails/pull/53236) | ||
|
||
``` | ||
# Before | ||
response.content_type = "text/html" | ||
# After | ||
response.content_type = :html | ||
``` | ||
|
||
[Parallel tests with :number_of_processors uses cgroups-aware usable processor count](https://github.com/rails/rails/pull/53629) | ||
When using parallel tests the default will now try to allocate a worker pool based of the total number of processors available to the system. | ||
|
||
[Fix Mysql2Adapter support for prepared statements](https://github.com/rails/rails/pull/53692) | ||
If you're using the Mysql2 adapter and rely on prepared statements, you may want to wait for the next bug-fix release before upgrading to Rails 8.0. | ||
|
||
[Silence deprecate message during "app:update" command](https://github.com/rails/rails/pull/53647) | ||
When running the `app:update` command you previously may see warnings due to not adopting the `new_framework_defaults`. This PR silences those messages to avoid confusion. | ||
|
||
[Reword error message for NoDatabaseError](https://github.com/rails/rails/pull/53698) | ||
This patch adds some suggestions on what to do when you run into this error. | ||
|
||
[Redesign ActionView::Template::Handlers::ERB.find_offset to handle edge cases](https://github.com/rails/rails/pull/53657) | ||
Some excellent work was put into improving the ERB template error highlighting in this PR, as well as fixing a bug with [multibyte character tokenization](https://github.com/rails/rails/pull/53655). | ||
|
||
[Make column_definitions queries retryable](https://github.com/rails/rails/pull/53643) | ||
Previously when an application wasn't using a schema cache in production a `ping` query would be executed for each table when it was loaded the first time. | ||
|
||
[Make Action Dispatch Session#store method conform to Rack spec](https://github.com/rails/rails/pull/53626) | ||
The [Rack specification](https://github.com/rack/rack/blob/main/SPEC.rdoc) states that a hash-like object stored in environment with `rack.session` key must implement `store/2` method with `[]=` semantics. | ||
|
||
[Preserve timezone and locale in ActiveJob exception handlers](https://github.com/rails/rails/pull/52188) | ||
This PR fixes a bug where the job locale and timezone were wrong inside the `rescue_from` block. | ||
|
||
|
||
_You can view the whole list of changes [here](https://github.com/rails/rails/compare/@%7B2024-11-15%7D...main@%7B2024-11-22%7D)._ | ||
_We had [26 contributors](https://contributors.rubyonrails.org/contributors/in-time-window/20241115-20241122) to the Rails codebase this past week!_ | ||
|
||
Until next time! | ||
|
||
_[Subscribe](https://world.hey.com/this.week.in.rails) to get these updates mailed to you._ |