See all articles

Rails 7 - what is new?

The 7.0 release brings Rails closer to the ideal of ‘The One Person Framework’. What does it change for existing web apps and brand new products?

Rails 7 – what is new?

The latest Ruby on Rails version – Rails 7 – is now in production. It was released on December 15, 2021, and is a continuation of the vision for simplifying the development of robust web applications in a short time.

The latest version of Rails tackles both the front- and back-end challenges. It employs the latest technologies and embraces:

  • Improved security
  • Even better developer efficiency
  • A no-Node approach to the frontend with access to NPM packages and modern JavaScript
  • And more.

The framework’s creator – David Heinemeier Hansson – said that the latest release brings Rails *much closer to the ideal of ‘The One Person Framework’.*

In this article, we’ll take a closer look at the most important features that Rails 7 brings to web app development.

Ruby on Rails in 2022

Ruby on Rails is an open-source server-side framework used to build web applications. It applies the Model-View-Controller (MVC) architectural pattern, providing default structures for databases, web services, and web pages. Developing apps in Ruby on Rails is cost-effective, flexible, and super-fast.

Ruby on Rails was built by David Heinemeier Hansson in 2005 and revolutionized web development. The framework has been actively developed ever since, and in 2022 it’s also used by both, early-stage startups and enterprises, such as Airbnb, Shopify, or Twitch.

Despite that, we’ve seen a lot of people asking whether Ruby was dead all these years. Ruby on Rails has actually experienced a renaissance in 2021. It’s still the best tool on the market for quickly bootstrapping startup and large enterprise applications in a short time.

And with the new version bringing a lot of fresh and game-changing features to the table, Rails is more powerful than ever. Sorry, haters! 😉

Rails 7 – what is new?

Let’s take a look at some of the new features that Rails 7 brings to web app development.

Stimulus JS framework is now available by default

The Stimulus framework has been integrated directly as the new default. Stimulus is a JavaScript framework that helps to manipulate existing HTML code and add JavaScript code to it. It’s a perfect replacement for frameworks like Vue or React when we want to quickly build a rich web application with outstanding user interface design.

Stimulus pairs with Turbo (also the new default). Together, they deliver a complete solution to build applications with a great user experience with a minimal amount of coding effort.

Improved security with encryption on the database layer

As for backend upgrades, Rails 7 keeps the data encrypted while it’s live in the database. Rails provided the usual at-rest and in-transit encryption before, but the at-work encryption provides an extra security layer. The Active Record Encryption implemented in Rails 7 enables developers to define what constitutes sensitive information in a product and control how this information can be accessed.

It allows to encrypt any value in the database and decrypt it inside the application. However, by default, it’s not possible to query a column with an encrypted value. In order to do so, you need to switch to a less secure mode.

Node.js is no longer required to manage JavaScript assets

Rails 7 replaces Webpacker with import maps as the default. The import maps feature allows to directly pin a JavaScript library into a Rails application using a content delivery network (CDN). It’s also possible to download all assets into the application directory instead of employing a CDN, which may result in increased effectiveness if we optimize performance.

Using Webpack, Esbuild, or Rollup is for a more advanced setup (for example, for React and JSX) remains possible.

Improvements to the Active Record library

Active Record is responsible for representing the business data and logic in Rails applications. Now it provides a new querying method – asynchronous querying – which fetches records in the background. It’s yet another significant performance improvement.

Asynchronous querying is an easy way of checking whether a given association is present for the record we want to pull from the database. It also enables to easily pull only one record from the database, and raise an error if no record is found, or when multiple records are found.

To access the complete list of changes, see Ruby on Rails 7.0 Release Notes.

Choose Rails 7 in 2022

If your app runs on Rails 6.1 or an earlier version, upgrading it with the latest features of Ruby on Rails 7.0 will ensure increased security, more cost-effective maintenance and development, as well as improved app performance and user experience.

In case you’re planning to build a new product in 2022, we highly recommend using Rails 7 to avoid extra update costs and benefit from simplified software development.

At iRonin.IT we’ve been building Rails applications from scratch and managed system updates for over 10 years. Our experienced software developers are there to:

  • Streamline your upgrade
  • Make sure your app works smoothly using the new system
  • Develop a new RoR application.

Get in touch and let’s see how we can help you.

Read Similar Articles