Paul Krill
Editor at Large

Ruby on Rails 7 overhauls JavaScript support

news
Sep 21, 20212 mins

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

two rubies ruby
Credit: Aleksey Nemiro

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 <a href="https://github.com/rails/jsbundling-rails/" rel="nofollow">-javascript[bundler]</a> 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 guides.rubyonrails.org. 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.
Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author