Ruby on Rails 7 overhauls JavaScript support

Alpha release of Rails 7 tosses Webpacker in favor of a Node-less approach to JavaScript bundling.

Ruby on Rails 7 overhauls JavaScript support
Aleksey Nemiro (CC0)

Ruby on Rails 7, a planned upgrade to the 17-year-old web application framework, has moved to an alpha stage, with a new mechanism for writing JavaScript in Rails.

Moving past the Webpacker tool for bundling JavaScript, which Ruby on Rails has used for the past five years, Rails 7 takes a no-Node approach, without having to give up NPM packages. This approach avails itself to advancements in browser support for ECMAScript 6, JavaScript modules, HTTP/2, and the Import Maps for Rails tool for importing JS modules.

Further, with the replacement of TurboLinks and Rails UJS by the Stimulus JS framework and Turbo tool to reduce the need for custom JS, Rails now has a complete in-the-box front-end setup for writing Rails applications. There is no need to deal with Node dependencies in node_modules, with bundler configurations, or with other common JavaScript development challenges, according to a September 15 bulletin announcing the alpha release.

The developers of Rails also have improved integration between Rails and JavaScript + CSS bundlers. Companion gems that can be triggered via Rails’ new -javascript[bundler] and -css[bundler] enable starting of a new application or changing one that begins with import maps to use Esbuild, Rollup.js, Webpack, and other technologies.

Instructions on getting started with Rails can be found at Other additions and changes in Rails 7.0:

  • Encrypted attributes have been added to Active Record, enabling an application to offer at-work encryption in addition to traditional at-rest and in-transit coverage. This provides additional security.
  • Asynchronous query loading for running queries in parallel.
  • The Spring application preloader for Rails is no longer on by default, with faster computers having made it less relevant.
  • ActionController::Live#send_stream makes it easy to stream files being generated on the fly in controller actions.
  • Active Storage now uses the more secure and faster libvips as its default variant processor.
  • Parallelized testing now compares a CPU core count to a test count and scales parallelization accordingly.

Copyright © 2021 IDG Communications, Inc.

InfoWorld Technology of the Year Awards 2023. Now open for entries!