Latest version of Rails has now released on July 22, 2019, which is Rails 6. This might be the best-practiced RC (release candidate) in Rails history. Rails has been released with three beta versions. With the official arrival of Rail 6, we collect all the major new features coming your way. It is an exciting release because of some enormous highlights coming upstream from the Basecamp and GitHub ventures. Among the numerous minor updates, helpful changes and bug fixes, Rails 6 will ship with two totally new frameworks: ActionText and ActionMailbox, and two major scalable by default features include: parallel testing and multiple database support. So set your Gemfile to get Rails 6.0.0.rc1 and we should begin!
New features of Rails 6-
1. Action mailbox-
ActionMailbox is an impressive new framework that allows you to route approaching mail into controller-like mailboxes for handling. This is another feature that comes extracted out of Basecamp, prepared to use in Rails 6. Incoming mail is stored in a database table called InboundEmail and ActiveJob is used to integrate the automation together. There are many exciting conceivable use cases for this, and many ideas will come into your head when you begin to consider it. For instance, when a user replies to an automated email that your application sent notifying them about a remark. The client could answer to that email, and your application could process that email and transform it into an a reply comment in your application automatically. As should be obvious, this is very powerful and flexible feature that we can not wait to get our hands on.
2. Action Text-
This is another extraction from Basecamp. As per Trix, this is a rich text content and supervisor for ordinary writing that included to Rails 6. This editor handles everything from formatting, quotes, records and installed pictures and galleries. Any embedded pictures or attachments are consequently stored using Active Storage and related with the RichText model. Activity Text previously incorporated into Rails 5.2, so more number of developers may have utilized it and furthermore mindful of the difficulties if they have confronted. This will give you opportunities to alter and bring rich text content.
3. Parallel testing-
Another scalable by default feature coming to Rail 6 is support for parallel testing. By running the test suite on numerous threads (each with their very own version of the test database), this new feature will empower quicker test suite run times and proficiency. Possibly not the most exciting feature, however unquestionably one which large projects will be appreciative for. You can determine the number of threads to use in an environmental variable. This is valuable for working with your CI system, which would regularly have an alternate set-up from your local machine.
PARALLEL_WORKERS=3 rails test
Alternatively, to make universal changes, you can add this line of code to the parent test class:
4. Multiple database support-
Ever imagined that your application could connect with and switch between numerous databases simultaneously? You should do this for scalability or performance reasons. A regular situation is database setups using a master-slave scheme, where the database is replicated over numerous servers, with the master node receiving all write operations, which are then propagated to slave servers. These, thusly, work as read-only to the application – clarifies Michał Buszkiewicz, the Rails developer at Prograils. He includes that beforehand, commonly used solutions for this and similar purposes included gems, for example, ar-octopus – which has served as a motivation to bring this kind of functionality into Rails core.
To meet this purpose, Rails 6 gives an API for multiple databases support, which will empower you do it without delving somewhere down in Active Record.
Webpack bundler has been included as default in Rails 6. Already Rails utilizes Assets Pipeline to built JS and CSS. But now, utilizing webpacker gem, all StyleSheets, pictures and JS libraries wrap into a single bundle with a single access point. A few people already utilizing webpack bundling with rails 5.1+ version. But, in that version, we have to configure it utilizing the command ‘rails new application – webpack’. Presently, it is by default into the rails application. Webpack is a static module bundler for modern js applications. Webpack helps during interfacing Rails application with UI frameworks like ReactJs, AngularJs, VueJs, and so forth. Likewise, utilizing this we can easily build hot reloading into Rails 6 application. The webpacker gem furnishes integration with webpack and npm/yarn. Npm and yarn both popular for quick, reliable, and secure dependency management.
6. Zeitwerk- The new code loader
Zeitwerk is a new and improved thread-safe code loader for rails. This replaces the current code loader which has been around since 2004, which has done admirably, yet has some major limitations.
These features are said to be turning the Rails group’s attention away from areas where the framework could be improved concerning performance or scalability. While a few people have condemned the highlights of Rails 6, others have praised the incorporation as keeping up with the spirit of Rails continually expecting to give opinionated, generic and standardized solutions for normal issues.
Are you looking for a website or mobile app development for your business? Solace experts are there to help you with advanced versions of Rails 6. For an effective and efficient web development with Solace, Contact us.