Rails 6.1 has been released and wow does it have a lot of great stuff! The changes include improvements to multiple databases, adding support for destroying associations in jobs instead of in-memory, turning errors into objects, and so much more.
Browser native support for lazy loading images is now a part of the official HTML standard and this PR adds Rails.application.config.action_view.image_loading to configure sitewide default for the loading html attribute to enable lazy loading sitewide without changing code.
Another image_tag change, which introduces Rails.application.config.action_view.image_decoding to configure the default value of the image_tag :decoding option.
Rails gives a warning if an enum method uses the not_ prefix as it might conflict with negative scopes. The initial implementation warned even when there was no actual conflict and this change improves that and only warns about negative enums if a positive form that would cause conflicts exists.
If we have data: { disable_with: false } then auto-disabling is turned off, but if we set automatically_disable_submit_tag to false it changes the behaviour of disable_with in an unexpected way, so explicit usage of disable_with: false starts to enable auto-disabling with false as the value of a disabled button. With this change auto-disabling is turned off if we have explicit disable_with: false no matter what is set in automatically_disable_submit_tag.
Rails 6.1 added strict_loading_by_default but that causes issues with the fixtures as they are lazy loaded. To get around it, this change ignores the strict loading flag when the fixtures are loaded.
reload was not default_scoped by default because you could be creating a record that does not match your default scope and therefore reload wouldn't find the record. However, in the case of sharding an application you may want reload to support default_scope because you'll always have the correct scope set.
In Rails 6.0, the translate helper always returned nil when given a nil key, but in Rails 6.1, the translate helper always raised an I18n::ArgumentError when given a nil key. This PR fixes the translate helper to mirror the I18n.translate behaviour when given a nil key, with and without a default.
45 people contributed to Rails in the past 2 weeks. Check out the open issues if you want to be one if them next time!. Until next week!