नमस्ते, This is Emmanuel Hayford with some updates from Rails!
Hide changes to before_committed! behaviour behind config
This PR introduces a new configuration option that will enable before_committed! callbacks on all enrolled records in a transaction by default in Rails 7.1. Previously, callbacks were only run on the first copy of a record if there were multiple copies of the same record enrolled in a transaction.
TimeHelpers: include with_usec keyword parameter on travel & freeze too
ActiveSupport::Testing::TimeHelpers now accepts a named with_usec argument to freeze_time, travel, and travel_to methods. Passing true prevents truncating the destination time with change(usec: 0).
Allow f.select to be called with a single hash containing options and HTML options
select can now be called with a single hash containing options and some HTML options.
Previously, this would not work as expected:
<%= select :post, :author, authors, required: true %>
Instead, you needed to do this:
<%= select :post, :author, authors, {}, required: true %>
Now, either form is accepted, for the following HTML attributes: required, multiple, size.
Fix inconsistent behavior in form helper date/time tags with options
DateTime form helpers (time_field, date_field, datetime_field, week_field, month_field) now accept an instance of Time, Date and DateTime as :value option.
Previously we had:
<%= form.datetime_field :written_at, value: Time.current.strftime("%Y-%m-%dT%T") %>
And now:
<%= form.datetime_field :written_at, value: Time.current %>
Document four ways to preload STIs
This PR documents a couple of ways to preload STIs. The document is on Edge Rails Guides and you can read all about it.
Thanks to the 26 contributors we had in the last week!
Talk to you next week.
Hide changes to before_committed! behaviour behind config
This PR introduces a new configuration option that will enable before_committed! callbacks on all enrolled records in a transaction by default in Rails 7.1. Previously, callbacks were only run on the first copy of a record if there were multiple copies of the same record enrolled in a transaction.
TimeHelpers: include with_usec keyword parameter on travel & freeze too
ActiveSupport::Testing::TimeHelpers now accepts a named with_usec argument to freeze_time, travel, and travel_to methods. Passing true prevents truncating the destination time with change(usec: 0).
Allow f.select to be called with a single hash containing options and HTML options
select can now be called with a single hash containing options and some HTML options.
Previously, this would not work as expected:
<%= select :post, :author, authors, required: true %>
Instead, you needed to do this:
<%= select :post, :author, authors, {}, required: true %>
Now, either form is accepted, for the following HTML attributes: required, multiple, size.
Fix inconsistent behavior in form helper date/time tags with options
DateTime form helpers (time_field, date_field, datetime_field, week_field, month_field) now accept an instance of Time, Date and DateTime as :value option.
Previously we had:
<%= form.datetime_field :written_at, value: Time.current.strftime("%Y-%m-%dT%T") %>
And now:
<%= form.datetime_field :written_at, value: Time.current %>
Document four ways to preload STIs
This PR documents a couple of ways to preload STIs. The document is on Edge Rails Guides and you can read all about it.
Thanks to the 26 contributors we had in the last week!
Talk to you next week.