Saturday, February 4, 2017

This Week in Rails: Fresh code to fight the Winter doldrums

Posted by andatki

Hello! This is your host Andy, bringing you another edition of This Week in Rails.

I’m in a cold Northern climate ❄️️ and we’re in the middle of Winter right now. To me, it’s the best time of the year to stay inside and dive into some new code. Let’s take a look at some of the latest changes made to Ruby on Rails in the past week.

This Week’s Rails Contributors

We had 31 contributors this week. There are lots of PRs for bug fixes which are nice to see. Many thanks to all of the contributors!

New

Add warnings option to test runner

This change provides an option to enable Ruby’s warnings in tests.

Improved

Refactor Active Record reflections

This PR refactors reflections such that we can iterate over each reflection and ask the reflection object what scopes should be applied to the query we are currently building.

Report the attribute on ActiveRecord::SerializationTypeMismatch

When a ActiveRecord::SerializationTypeMismatch error occurs, we will now know which attribute caused the error.

Simplify query in column_definitions() for Postgres

This patch updates how column_definitions() for Postgres is calculated. The author has a nice usage of the EXPLAIN tool, to show that the new implementation is more efficient.

Fixes

Reload through_record that has been destroyed

For has_one :through associations, if through_proxy is not reset, setting a new record causes the runtime error Can’t modify frozen hash.

Wrapping up

That’s it from This Week in Rails. There were many other great contributions, too numerous to list here, but feel free to check them out!

Catch you next week!