Friday, October 9, 2015

This week in Rails: Performance, Test Helper Changes, Mailer Preview Improvements and More!

Posted by toddbealmear

####

tap tap

Is this thing on?

Hey, everyone! Welcome to the latest edition of This Week in Rails - your one stop shop for all the goings-on in the Rails universe. My name is Todd and I’ll be your guide. Let’s get this party started!

This Week’s Rails Contributors

We had 41 extraordinary people commit to Rails this past week, including 15 (!) newcomers. Wanna see your name on this list? Check out the list of issues.

New Stuff

Add Equality Comparison for AttributeSet

Exposes an equality comparison method (==) for comparing ActiveRecord::AttributeSet objects to each other.

Improved

Persist Format in Mailer Previews

Have you ever changed the format for a mailer preview, made a code change, and reloaded the preview only to have the desired format change back to the default? How annoying! This change utilizes JavaScript’s history.pushState to persist your desired format across refreshes. Nifty!

Performance Improvement for Active Record preload

This patch conditionally skips an expensive method call unless it’s explicitly required when calling preload on an ActiveRecord::Relation. The net benefit is an overall reduction in allocated objects and ~40% increase in speed.

Support Arrays in Active Job’s assert_enqueued_jobs

This brings Active Job’s assert_enqueued_jobs into parity with assert_performed_jobs. Specifically, the :only option now accepts Arrays.

Fixed

Fix Mounted Engine Route Regression

A regression in 4.2.3 would cause the relative_url_root and script_name to each be included in routes for mounted Engines (the expected behavior is for one, not both to be used). This patch resolves that issue on master and 4-2-stable.

Fix Test Helper Casting for Active Job

Fixes an issue where the at: argument wouldn’t be cast properly for assert_enqueued_with and assert_performed_with, causing tests to fail.

Removed

Remove pk_and_sequence_for for MySQL Adapters

pk_and_sequence_for is not used by MySQL adapters and is being removed. There won’t be a deprecation cycle for this change, so note that your implementation may break if you’re overriding this method anywhere.

Wrapping Up

That’s all for This week in Rails. As always, there are many more changes than we have room to cover here, but feel free to check them out yourself.

Until next time!