Hello everyone! This is Roque bringing you the latest news from the Rails world.
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.
class_attribute
Rails will now make it easier to set default values to class attributes like class_attribute :timeout, default: 5
New apps generated with JavaScript and Sprockets support will use mini_racer
for the Ruby platform. A faster and more reliable interpreter.
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)
.
number_to_human
round calculationThis 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"
.
Previously, methods like pluralize
and singularize
would only use the English uncountable rules rather then the ones for the locale that was passed.
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.
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!