Tuesday, April 2, 2019

New versions of Rails, optimizer hints, ROFL, and more

Posted by dodecadaniel

Hi there! This is Daniel reporting from Brooklyn, NY.

New versions of Rails released

Rails 5.2.3 and Rails 5.1.7 were released last week. Check out the CHANGELOG and upgrade today!

Optimizer Hints and Annotations

These two related PRs were opened within a couple hours of each other. The new optimizer_hints method offers a simple way to include optimizer hints in your queries. The new annotate method offers a simple way to annotate your queries with comments.

The best PR that I saw this year!

This PR elegantly ensures that ActiveSupport::SafeBuffer’s sub, sub!, gsub, and gsub! methods set back references. I learned a lot about Ruby by reading through this code and the review comments.

Stop ROFL

I always enjoy removing code that is no longer needed. It must be especially fun to remove code that includes the comment “I will explain the roflscale so that others will not rm this code.”

Use weak references in the descendants tracker

Nobody wants a memory leak. Keeping track of these references allows us to garbage collect anonymous subclasses.

Advancing to dates before 1001-03-07

I am constantly plagued by bugs related to time. This PR reminds me how complicated time really is.

Allow disabling of console sandbox

Has anybody else ever opened a production console session and fogotten to close it? ✋ Ever done it with the --sandbox flag and caused your database to run out of memory? 😭 Thanks, Rails, for protecting me against myself.

Improved error messages from views

Thinking about contributing to Rails? Check out this PR from a first-time contributor for inspiration.

55 people contributed to Rails in the last 2 weeks, including 6 first-time contributors. You can see the full list of changes here.