JavaScript support for Ruby on Rails 7 rejiggers


Ruby on Rails 7, the latest version of the web application framework, is now available in production. The update takes a comprehensive approach to web development with support for advanced JavaScript.

Released on December 15, Rails 7 takes advantage of browser support for the ECMAScript 6 JavaScript standard and ECMAScript modules, the widespread adoption of HTTP / 2, and the map import standard for import. JavaScript modules. It offers developers a “node-less” approach to front-end development while providing access to NPM packages and modern JavaScript. Rails 7 replaces TurboLinks and Rails UJS with Turbo and Stimulus from Hotwire on the front-end.

Most Rails apps won’t need Node.js, given the new defaults. Developers can use whatever JavaScript bundle they prefer, as Webpack is no longer required. The same approach has been taken with CSS bundlers that rely on Node; Rails 7 files only require a compiled application.css file. Bundlers such as Tailwind or Bootstrap can be used.

Rails 7.0 guides are available at The Rails 7.0 release notes are also available on the project website. Other improvements in Ruby on Rails 7:

  • Encrypted attributes have been added to Active Record, allowing applications to offer encryption at work in addition to traditional coverage at rest and in transit. An additional layer of security is provided with this enhancement.
  • With asynchronous query loading, two unrelated queries can be executed simultaneously through a controller action.
  • The Zeitwerk code loader replaces the const_missing approach.
  • Spring Application Preloader is no longer enabled by default, as faster computers have made it unnecessary except for larger applications.

Copyright © 2021 IDG Communications, Inc.


Comments are closed.