Ruby on Rails 8.1.0 Release Candidate 1 released
The first release candidate of Ruby on Rails 8.1.0 is now available for testing. This version adds a number of important new features and updates. The Model-View-Controller (MVC) pattern is used to build the framework, which divides an application into three layers: Model, View, and Controller.
One of the biggest changes in Active Support is that deprecated methods like passing a time object to Time#since, Benchmark.ms, and adding time instances with ActiveSupport::TimeWithZone have been removed. Additionally, there is support for the to_time method, which maintains the system's local time and the config.active_support.to_time_preserves_timezone setting.
Also, assert_event_reported error messages now use standardized event name formatting, where the event name now uses .Check (for example, name: "user.created") to make sure that assert_events_reported matches and that there is a clear difference between strings and symbols.
ActiveSupport::FileUpdateChecker doesn't rely on Time.now to stop time travel test helpers from reloading files that don't need to be. You can turn on event reporter debug mode in tests with ActiveSupport::Testing::EventReporterAssertions#with_debug_event_reporting.
A new framework default has been added to JSON so that LINE SEPARATOR (U+2028) and PARAGRAPH SEPARATOR (U+2029) don't have to be escaped. This is because these characters weren't allowed in JavaScript literal strings before ECMAScript 2019, but now they are, so modern browsers don't need them.
ActiveRecord has also been updated. For example, it now has structured events like active_record.strict_loading_violation and active_record.sql. To fix a problem where integration tests running at the same time would choose the base test database instead of the numbered parallel worker database, replicas are now part of the setup for parallelizing test databases.
You can now set up password reset tokens for has_secure_password. With the option reset_token: { expires_in: ... }, you can set how long password reset tokens will last.
You can now use integer shard keys, and the only_columns method can be used instead of ignored_columns when working with old or shared database schema.
By using a different cache store for each thread, the query cache for pinned connections in multi-threaded transactional tests has been fixed. This makes system tests and any test that uses more than one thread more accurate.
Active Storage has been updated with a number of new features, such as new structured events like active_storage.service_upload, active_storage.service_download, active_storage.service_streaming_download, active_storage.preview, active_storage.service_delete, active_storage.service_delete_prefixed, active_storage.service_exist, active_storage.service_url, and active_storage.service_mirror.
You can now fully set up analyzers and variant transformers. This includes the option to set ActiveStorage.analyzers to an empty array or to use a custom analyzer. You can also turn off the variant processor to stop getting warnings about missing gems.
Action View has also been updated. For example, it now has new structured events like action_view.render_template, action_view.render_partial, action_view.render_layout, and action_view.render_collection.
Action Text now lets you capture block content for form helper methods. This means that you can use a direct-upload:progress event listener and promise resolution in the @rails/actiontext/attachment_upload.js file.
Finally, Railties has a few updates, such as getting rid of old commands like STATS_DIRECTORIES, bin/rake stats, and rails/console/methods.rb. The scaffold generator no longer makes system tests by default, but you can turn this on with the --system-tests=true option or by running bin/rails generate system_test name_of_test.
Rails/rails Release 8.1.0.rc1
Active Support Remove deprecated passing a Time object to Time#since. Rafael Mendonça França Remove deprecated Benchmark.ms method. It is now defined in the benchmark gem. Rafael Mendonça Franç...
