This week in Rails: GSoC, performance improvements and bug fixes!

Hello everyone! This is Marcel with help from Andy (welcome!) bringing news from yet another week of Rails.

Google Summer of Code 2015

The fourth year of participation in Google Summer of Code 2015 is over with excellent work done in the areas of Asset Pipeline (performance and… source maps!), Web Console (browser extension), the Rails test suite (Regression Test Selection), development setup (evented file system monitoring) and internals refactoring (cookies). Special thanks to Google, mentors and students who made this all possible.

This weeks Rails contributors

46 people contributed to Rails this week, including 7 first-time contributors! If you are interested in becoming a contributor, you can have a look at the issues list.

New Stuff

Introduce Active Record ignored_columns

A use case for this would be ignoring columns that are transient. This may happen when using online schema change tools like lhm or pt-online-schema-change.

Foreign keys are now supported in create_table DSL

Not only is it more convenient to pass in the foreign_key as an option to the references method of the create_table DSL, it generates slightly more efficient SQL.

Improved

Improve the performance of Active Record save and friends

By taking advantage of internal code improvements (the MutationTracker object), Active Record’s save and similar methods have received a noteworthy performance improvement.

Change assert_difference to return the result of the yielded block

With this we can perform new assertions on the returned value without assigning it to an outer variable or otherwise wrapping subsequent assertions inside the assert_difference block.

Fixed

Fix arguments of AR::Calculations#sum

The arguments and behavior of #sum are now consistent with the other aggregate methods (count, average, minimum, and maximum) defined in ActiveRecord::Calculations.

Fix silent failure when MySQL is not running

Nothing is more frustrating than a silent failure. This fix handles an error when rake db:structure:load is run and MySQL is not installed. Previously there were no output.

Active Record: Use database precision when assigning a value to a timestamp attribute

Timestamp columns can have less precision than Ruby timestamps. This affects how a fraction of a second can be stored in the database. To fix this, the precision of the column was used when assigning a value to the timestamp attribute.

Fix ignored usages of unscoped when preloading Active Record models

Preloading an association that is using unscoped was dropping the unscoped part.

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!