Overview of Ruby on Rails 6: Will It Simplify Your Code?
Have you already heard of the latest Ruby on Rails 6 release? We guess the answer is yes, for this is an important event in the IT industry, which cannot be ignored. Of course, we, too, gave due attention to the issue in question. We've tested and analyzed all the key Rails 6 features and are now ready to share our impressions and conclusions with you.
What is Ruby on Rails?
Ruby on Rails is an open-source web framework making the development process convenient and fast. It means Rails devs get a perfect tool to work more efficiently, and they're really happy about it. Indeed, their job is greatly simplified, why not enjoy it?
Ruby on rails mobile app development has many advantages, and they can be discussed for a very long time. And we'll definitely talk about them in our other articles. This one is dedicated to another issue, namely, the latest framework's updates.
But first, let's answer the question: why do you need to use the newest RoR version? Maybe, the old ones will do quite well too?
Reason to upgrade your Rails applications
If you're only thinking of creating a web application (even it’s planned to be a very simple rails app), then the choice is obvious: you need to use Rails 6.0.0 rc1 (certainly!). However, if your web resource is already actively working, you should take care of upgrading it too. Why? Here are a few reasons:
Fixing bugs. None of us is without stain, and even the most advanced technology is fraught with certain errors (which cannot be detected immediately). Alas, Ruby on Rails is no exception. Its new versions are intended (first of all) to fix such bugs.
Improving features. This is not necessarily about errors, sometimes a new release of the framework offers better versions of old features. In the end, there's always room for improvement, technology is evolving, and Rails applications must evolve too.
New features. Fixing bugs, improving old features... what else remains on the list? Of course, an extension of the existing functionality! It would be a shame to miss the appearance of a new cool feature, right?
Security. The latest releases will receive patches and new versions in case of security problems. Otherwise, you cannot be 100% sure that your Rails app is securely protected.
Unsupported release versions. When the release version is no longer supported, you yourself are responsible for possible software bugs. If you don’t want to do unnecessary work, upgrade your web app to a supported version.
Well, have we convinced you? Then let’s discuss the latest release of Ruby on Rails.
RailsConf 2019: ruby on rails 6 release date
The first announcement of future changes was made at the beginning of 2019. And the Rails developers claim that the final release of the updated framework isn’t fundamentally different from the preliminary beta versions. All the improvements made over the past few months are more like polishing and glossing when a good product is brought to perfection (as much as possible).
Anyway, the final release was presented to the public at the conference called RailsConf 2019. It took place in the spring of 2019 in Minneapolis and lasted several days. And those who didn't have the opportunity to attend the conference in person can now watch RailsConf 2019 videos.
However, enough beating about the bush, right? It’s time we answered the main question: what's new in Rails 6?
New or Updated Rails 6 Features
Let's get down to the fun part and start a discussion of the key Rails 6 features: new, improved, updated. What have Rails developers done to facilitate the creation of sites and web applications, to make the whole process more pleasant? What features are now working better, faster, with greater stability?
We won't go into all the details (at least, too much), we'll just talk about the most important points so that you make up your own opinion about the advantages of Rails 6 development.
Probably, the most interesting innovation Rails 6 offers is Action Text which finally includes a full-featured rich text editor in the default Ruby on Rails gem list. Basically, it is wrapped around Trix Editor - a WYSIWYG library created by Basecamp developers who claim that it overcomes typical cross-browser compatibility issues.
Anyway, we’re no more dependent on third-party gems mending JS libraries like TinyMCE with its recurring problems of handling image uploads, etc. Action Text is connected with Active Storage (see below) and requires no configuration to work properly. At least it seems so at first glance.
Action Mailbox is supposed to fit mail inbox into MVC pattern by introducing an InboundEmail class (which in fact is an ActiveRecord model). The main trick is saving email bodies, attachments, and lifecycle data, as well as an ActionMailbox class itself.
Its functioning principle is similar to how the controller works, namely: determining the actions to be performed when receiving mail. Action Mailbox incorporates client libraries for major mail managing services like Mandrill, Postfix, Mailgun, and others.
Another example of new Rails 6 features is Parallel Testing. Its main goal is to significantly reduce the test running time. Under the cover, it uses two options to parallelize test processes:
The first and default one is the DRb library, internal Ruby way of forking multiple processes without any system protocols.
The second option is to use threads.
As we've said in one of the previous sections, some features need improvement and modification. And this is exactly what happened with Active Storage - a feature prominently presented in Rails 5.2.
Active Storage has gained a predictable load of fixes and enhancements. Thanks to them, it supports BMP, TIFF, and progressive JPEG variants. And another piece of good news: Google Cloud Storage with streaming downloads has also been added. It means that from now on the files are uploaded only when the record is saved, and not immediately, which is definitely a more predictable and consistent behavior.
Besides, instead of relying on standard MiniMagick library as a default image processor, Active Storage switched to image_processing gem. And such a solution is much more versatile because, apart from ImageMagick and GraphicsMagick, it supports a newer libvps library. And this library, by the way, shows great results in terms of both speed and memory consumption.
Other improved features in Rails 6
Looking through other minor improvements, the tendency to expand multiple database support becomes evident. It’s especially crucial when it comes to high-load, distributed or data-heavy projects. The newly presented features include: db:system:change command to change the database of the application, multiple database support for db:migrate:status command and an ability to use different migration paths from multiple databases in the generators.
We’re pretty sure all these updates will please those who use the Ruby on Rails framework to create progressive web apps. And how could they not be pleased? In the end, the changes listed are designed to make the web development process even easier and faster than it was before (although simplicity and speed were always important RoR advantages). So, now Rails devs are able to work on projects as efficiently as possible.
Do you have any questions left? We're happy to answer them and advise you on any issues regarding mobile and web development. Contact us!