This Week in Rails: class_attribute default, mini_racer and more!

Posted by repinel, June 3, 2017 @ 12:00 am in News

Hello everyone! This is Roque bringing you the latest news from the Rails world.

This Week’s Rails contributors!

We had 32 people who helped make Rails better this week. Three of them contributed for the first time ever! If you would like to help out, check the issues list.

Allow a default value to be declared for class_attribute

Rails will now make it easier to set default values to class attributes like class_attribute :timeout, default: 5

Replace therubyracer with mini_racer

New apps generated with JavaScript and Sprockets support will use mini_racer for the Ruby platform. A faster and more reliable interpreter.

New

Add previous and next day of week API to Active Support

The methods prev_occurring and next_occurring expect a day of the week and return the appropriate value based on the DateTime, e.g. DateTime.now.prev_occurring(:monday).

Fixed

Fix number_to_human round calculation

This fix a regression introduced in Rails 5, where a case like number_to_human(1_000_000, units: { unit: 'meter', thousand: 'kilometer' }) would return "1" instead of "1000 kilometer".

Fix pluralization of uncountable expressions when given a locale

Previously, methods like pluralize and singularize would only use the English uncountable rules rather then the ones for the locale that was passed.

Rename primary key index from rename_table

Formerly, rename_table would only rename primary key index if the column’s data type was sequential. Tables with primary keys with types like UUID would still keep the old name.

Improved

Allow additional options for poltergeist or capybara-webkit in System Tests

If using poltergeist or capybara-webkit, driven_by will register it as the driver and set additional options passed via :options param.

Please refer to drivers documentation to learn what options can be passed.

That’s it for this week, as always, we couldn’t cover all of the changes, but feel free to check the commits if you are interested. Until next week!