Hello everyone! This is Eugene, with a roundup of the last two weeks of activity in the Rails world. Let’s get started!
In the last two weeks, Rails saw contributions from 29 people, including 10 first-time contributors. Thank you all!
If you’d like to be included here, why not check out the list of open issues?
Enumerable#index_with
This new method converts an enumerable to a hash, where the keys are the enumerable’s elements and the values are determined by the provided block or argument.
Loading the mail gem during boot avoids burdening the first request with the responsibility, and conveniently sidesteps a deadlock that the author encountered in their application.
Range#===
and Range#cover?
on Range
Active Support extends Range#===
to match other ranges, but a change to the native Ruby implementation broke it. This patch ensures that the behaviour will work on Ruby 2.6, and also adds it to Range#cover?
for good measure.
xor_byte_strings
by 70%The benchmark included with this performance patch shows that it saves a cool 5 microseconds whenever Rails generates a CSRF token. 🐎
If a record’s associations contains valid but unsaveable data, it will now correctly fail to save and roll back its transaction.
When a record was saved multiple times in the same transaction, its previous state wasn’t always immediately restored if the transaction was later rolled back.
alter_table
for SQLite3 adapterTables that are referenced by foreign keys can now be successfully altered when using the SQLite3 adapter.
In related news, Rails 6.0 will require a minimum SQLite version of 3.8.0.
As always, there were many more changes to the Rails codebase than we can cover here - if you’re interested, you can check out the full listing of commits from the last two weeks. Until next week!