Friday, March 15, 2024

Active Record Basics Guide Refresh, Encrypted Attributes Re-Optimization, and more...

Posted by zzak

Hi, it’s zzak. Let’s explore this week’s changes in the Rails codebase.

The Rails World CFP will close in just one week on March 21.
Submit your talk in time!

Active Record Basics Guide
This PR refreshes the guide covering the basics of Active Record.

Do not try to alias on key update when raw SQL is supplied
A bug was found when updating duplicates with raw SQL.

Memoize “key_provider” from “key” or deterministic “key_provider” if any
Previously, this memoization was removed which lead to a performance hit for encrypted attributes.

Updating Astana with a Western Kazakhstan timezone
On March 1, 2024, Kazakhstan (all parts) switched to a single time zone UTC+5.
Using the latest tzinfo-data that updated the Kazakhstan timezones, ActiveSupport still showed the incorrect offset because it was pointing to the Asia/Dhaka Bangladesh timezone, which will not get the same TZ offset change.

Preserve encoding on “truncate_bytes”
This PR addressed an issue where String#truncate_bytes can return a string with a different encoding than the one being truncated.

Support custom blob key in ActiveStorage::Blob.compose
Since Rails 6.1, Active Storage has allowed to provide a custom key when attaching a new file.
This PR adds support when using the compose class method to customize the name of the underlying service object.

Fix MySQL adapter for inserts with aliases
This pull request addresses errors that occur when using MySQL 8.0.18 or lower version of MySQL 8.0.

Railties configure sanitizer vendor in 7.1 defaults more robustly
In order to avoid an issue where Rails::HTML::Sanitizer is not yet loaded, which resulted in the sanitizer vendor remaining as Rails::HTML4 and not be set to Rails::HTML5 as intended in Rails 7.1.

You can view the whole list of changes here. We had 20 contributors to the Rails codebase this past week!

Until next time!

Subscribe to get these updates mailed to you.