Rails Latest Version: The changes introduced in Rails 7.0.4

Tags
6 October 2022
Complete Guide for CTO & IT Directors
Microservices under X-Ray Three books image Download free ebook

On the 9th of September 2022 the latest version of rails, 7.0.4, was released. It was released alongside rails versions 6.1.7, and 6.0.6, and delivered some bug fixes (only for the 7.0.4 version, as the 6.0.x and 6.1.x aren’t supported for further bug fixes), better compatibility, and improvement to the performance.

As a platform designed specifically for web application development, Rails is known for its convention over configuration approach. This means that Rails focuses on simplifying the development process by relying on a set of default conventions. This directly translates to quicker development because you don’t have to configure every and each aspect of an application manually. The built-in testing support also helps produce the applications faster and less buggy.

These features make Ruby on Rails ideal for prototyping, so any development team should consider building their product in Ruby on Rails.

However, like with everything else, there are disadvantages to Ruby on Rails. For one, Rails isn’t that fast. Being written as a framework for Ruby (an object-oriented scripting language) it falls behind other compiled programming languages. Moreover, Ruby on Rails might be quite difficult and costly to scale. As it wasn’t designed with large applications in mind, it will require a lot of additional work if you want to properly scale a large Ruby on Rails application.

What the Rails latest stable version has to offer for web developers

The current stable version of rails, 7.0.4, brought a number of changes which we will go through below.

Active Support

Two changes here. Redis cache store is now compatible with the Ruby client redis-rb in version 5.0. The second change is a fix to the behavior of NoMethodError on custom ActiveSupport::Deprecation. The arity restriction on custom behaviors is now removed.

Active Model

Fixed name clashes in attribute methods code generation cache. Before, when two different methods had generated similarnames the first implementation would be re-used.

Active Record

A lot of changes and fixes here.

Firstly, symbol is by default allowed for YAML columns. Moreover, a number of smaller fixes such as ActiveRecord::Store serializing as a regular Hash, fixed lead_async scheduling AND using the query, fixing eager loading for models devoid of primary keys, and Hstore deserialized regression.

PostgreSQL time zone away type timestaptz was also added and is required for correctly parsing some of the values in your database.

Additionally, an issue with a stale relation cache_cersion was also fixed. Before the latest version of rails, when reset was called on a relation object it didn’t correctly reset the cache_version ivar. This could lead to a situation in which a correct data still were reported as a stale cache_version.

Action View

Two changes here. First is a guard against ActionView::Helpers::FormTagHelper#field_name calls with nil object_name. The second is the correct tagging of html_safe? strings returned from strip_tags which helps in avoiding double-escaping entities. As these strings contain no HTML there are safe to be included as PCDATA in HTML content.

Action Pack

The existing values in Server-Timing cannot be now overwritten by ActionDispatch::ServerTiming.

Active Job

One change: the deprecation warning was removed from ActiveJob::QueueAdapters::QueAdapter.

Action Cable

Just like with the cashe mentioned in Active Support, the Redis adapter is now compatible with reddis-rb 5.0 version. Moreover, redis-rb 3.x compatibility was dropped.

You can now mount the Action Cable server with anchor: true. The routes that start with /cable won’t clash with Action Cable.

Active Storage

A single change that foxes proxy downloads for files over 5Mb as before trying to view and download larger files from services like S3 via proxy mode could result in returning corrupted files.

Railties

Some of the changes introduced to the core of the Rails framework are skipping Action Mailer and Active Storage in a case when the Active Job is skipped or checking if the framework is disabled while running app:update.

If you wish to read more about the latest versions of Ruby on Rails, please see the official documentation for the complete list of the changes in the latest release. Moreover, the Rails community can surely provide details about some of the new features.

Talk with experts

We look forward to hearing from you to start expanding your business together.

Email icon [email protected] Phone icon +1 (888) 413 3806