πŸŽƒ Halloween Edition: Zeitwerk migration guide, selenium-webdriver, and some Ruby 3.1 snacks

Posted by zzak, October 31, 2021 @ 12:00 am in News

🍭 Trick or treat, zzak here after a week off with lots of goodies! 🍬

Rails Autoloader Migration Guide: From Classic to Zeitwerk

This new guide has all you need to know to switch the autoloader for Rails 6.x and 7.0 applications!

Add ActiveRecord::Base.prohibit_shard_swapping

This new method prohibits swapping shards within the given block. This can be useful if you’re using sharding to provide database isolation on a per-request basis.

Add support for setting the schema/structure dump filepath in the config

This PR adds the ability to specify the path used for schema dump files. For those using horizontal sharding, previously a schema file would be created for every shard which makes sharing the same migrations across shards more difficult.

Rails 7.0 requires selenium-webdriver >= 4.0.0

Previously, Rails generated a Gemfile with an alpha release for selenium-webdriver due to an incompatibility with Ruby 3.0

Replace Concurrent.monotonic_time with Process.clock_gettime

Since all modern Rubies support this interface a small optimization can be made to reduce method calls in Active Record connection adapters.

Enable eager loading by default on CI systems

When running your Rails app test suite inside of a CI environment that sets ENV[β€œCI”] it’s recommended to turn on eager loading to help identify errors that may only occur in production. This will be the default for newly generated apps.

Support RFC 4122 strings for namespace UUIDs

You can now effectively use an RFC 4122 compliant string by default in newly generated apps, or by enabling the new config.active_support.use_rfc4122_namespaced_uuids setting.

Use the native Class#descendants if available

With the addition of Class#decendents in Ruby 3.1, we can avoid iterating over every object in ObjectSpace to achieve the same feature. Also, check out #43548 for some additional refactoring of DescendantsTracker.

Call Executor#wrap around each test

Rails.application.executor hooks are now called around every tests which helps prevent state to leak from one test to another.

Add :day_format option to date_select

Similar to :year_format, this new option for date_select allows you to pass a lambda for setting the format to display days select options.

38 people contributed to Rails since the last time. All the changes can be checked here. Until next week!