Ruby on Rails is gearing up for its next big release. In the meantime, developers can check out the “highlight reel” of Rails 5.1.0 beta1, which cleans up deprecated code and includes major improvements to the ergonomics of Rails.
This version follows the release of Rails 5.0, which came out about eight months ago. The team has made great strides since then, according to David Heinemeier Hansson
In a blog post. And there are three major parts to this beta that lets Rails programmers extract the best from JavaScript, he wrote.
(Related: TypeScript is getting attention in the enterprise)
For instance, now programmers have the ability to manage JavaScript dependencies from NPM via Yarn. According to Heinemeier Hansson, Yarn is like Bundler for JavaScript: It will make it easier to depend on libraries like react or anything else from NPM.
“Everything you depend on via Yarn is then made available to be required in the asset pipeline, just like vendored dependencies would have been. Just use the binstub bin/yarn to add dependencies,” wrote Heinemeier Hansson.
Another improvement in the beta is the ability to optionally compile JavaScript with the module bundler, Webpack. There are plenty of module bundlers and compilers that work with JavaScript, but the Rails’ team said Webpack is emerging as the “preeminent choice.” With Rails 5.1, developers can use Webpack with Rails through Webpacker, which lets developers configure automatically on new projects with –webpack.
“This is fully compatible with the asset pipeline, which you can continue to use for images, fonts, sounds, whatever,” wrote Heinemeier Hansson. “You can even have some JavaScript on the asset pipeline and some done via Webpack. It’s all managed via Yarn that’s on by default.”
Also, Rails 5.1 drops jQuery as a necessary dependency, since Rails has rewritten rails-ujs to use vanilla JavaScript. Developers can still use jQuery, but now they no longer “have to,” wrote Heinemeier Hansson.
Rails also has a solution for complete system tests for Ruby called Capybara, and now developers have a wrapping of Capybara that’s preconfigured for Chrome. It’s enhanced to provide failure screenshots as part of Action Dispatch, according to Heinemeier Hansson. Developers won’t have to worry about extra database cleanup strategies anymore either, and the “baked-in transactional tests now roll back system test changes,” he wrote.
Also included in Rails 5.1 is encrypted secrets management. Encrypted secrets was inspired by developer Ara T. Howard’s sekrets: a command-line tool and library used to manage encrypted files and settings into Rails’ applications and repositories. Encrypted secrets allows developers to set up new encrypted secret files, which will generate a master key to store outside of the repository.
Rails is looking for developers to test this beta version. Basecamp 3 is already running in production in this beta, and while this is an incremental upgrade to Rails 5.0, it comes with hundreds of fixes and improvements across all of the frameworks, wrote Heinemeier Hansson.