This Week in Rails

December 21, 2024

Revert Active Model's Normalization and Cache Store gets session ID uniqueness flag

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

Fix "#to_query" to not include setter for nil values
To keep the behavior consistent with Rack::Utils.parse_nested_query.
# Before
nil.to_query("key") #=> key=
# After
nil.to_query("key") #=> key

Raise "ActiveRecordError" when "#increment!" called on new records
Similar to the behavior of #update_columns, an exception will be raised on records that haven't been saved yet or were destroyed.

Revert "ActiveModel::Attributes::Normalization"
In the last episode, we announced that ActiveRecord::Normalization was moved to Active Model.
That PR was reverted because the API wasn't ready and is still being worked on.

Add ":comparable" option to serialized attributes
This option was added to ease migration between different coders.
Refer to the API docs for more information.

Remove monkey patches of "Range#each" and "Range#step"
Technically these methods are equivalent to the native Ruby methods, so they can be safely removed.

Add "check_collisions" option to Cache Store
This new options was added for situations where guaranteeing uniqueness of the session ID is required.

Prevent Active Storage Blob from autosaving Attachments
This change should have no impact on existing applications, but will ensure that adding an attachment to a record doesn't automatically save it, causing other callbacks to run unexpectedly.

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

Until next time!

About This Week in Rails

Your weekly inside scoop of interesting commits, pull requests and more from Rails.