What’s new in Rails 6? - This article will introduce you to new Rails 6 features, explain how they should be used, and discuss what they can do to improve your workflow and ...
Rails 6 latest version rc2 has now released on July 22, 2019. This may be the best-exercised RC (release candidate) in Rails history. Because Rails has been released with three beta versions so far. Companies like Basecamp, Shopify and Github already using rc1 in the production. If you want to start a new rails app today then definitely you can use 6.0.0.rc1 or 6.0.0.rc2 gem version.
Let’s see what are the Rails 6 new features added in the final release of 6.0.0.rc1
In Rails 5, we were using ActionMailer to manage mails in the application.
Action Mailbox is extracted from Basecamp, which gives you the way for incoming emails to the mailboxes as a controller for processing in the rails application. Also, it has access to integrate Mailgun, Postmark and SendGrid. Along with that, you can implement and work on handling inbound mails directly via the built-in access to Exim, Postfix and Qmail.
The inbound emails are considered as ‘InBoundEmail’ records using Active Record and tracking of its lifecycle, store original email on cloud storage via Active Storage. Also, it is responsible for data handling with on-by-default destruction process. By default, an ‘InBoundEmail’ that has been successfully processed will be destroyed after 30 days. For more help click here.
NOTE.: Action Mailbox requires Active Job and Active Storage.
This is another extraction from Basecamp. According to Trix, this is a rich text content and editor for everyday writing that added to Rails 6.
This editor handles everything from formatting, quotes, lists and embedded images and galleries. Any embedded images or attachments are automatically stored using
Active Storage and associated with the RichText model. For more help click here.
Action Text already included in Rails 5.2, so many developers might have used it and also aware of the challenges if they have faced. This will give you opportunities to edit and bring rich text content.
Most WYSIWYG editors use HTML’s contenteditable and execCommand that are designed by Microsoft support team for Internet Explorer 5.5. And based on reverse-engineering, those things copied from other browsers, so during implementation, each browser has its own issues and that leads to inconsistency.
But, Trix uses HTML’s contenteditable as an I/O device and overcome this inconsistency.
NOTE.: Action Text requires Active Storage.
Rails 6 added parallel testing by default. This feature is built by Github. Parallel testing allows you to run each test parallelly. It reduces the time to execute the test suite.
The machine has multiple cores and can create workers too. Using Rails 6, we create workers and based on each worker, Rails create a test-database. So, the test will have these number of database to run the test suite. We can create workers in two ways:
If you love to run the test using threads and JRuby, then it has additional property as thread. To add this, you need to add
parallelize *(workers: :number_of_processors, with: :threads)* to your test_helper.rb. This threading parallelization is supported by Minitest’s Parallel:: Executor. For more help click here.
This is a small feature added in Rails 6. In this, Rails allows testing your action cable functionality at any level. The levels are:
We do a connection test to check the connection’s identifiers are assigned properly or are there any improper connection. Channel tests only assert the channel subscribes to the particular stream or not. The broadcast test is to check whether the message has been broadcasted inside other components. For more help click here.
Webpack bundler has been added as default in Rails 6. Previously Rails uses Assets Pipeline to built JS and CSS. But now, using webpacker gem, all StyleSheets, images and JS libraries wrap into a single bundle with a single access point.
Some people already using webpack bundling with rails 5.1+ version. But, in that version, we need to configure it using the command ‘rails new app --webpack’. Now, it is by default into the rails app.
Webpack is a static module bundler for modern js applications. Webpack helps during connecting Rails app with UI frameworks like ReactJs, AngularJs, VueJs, etc. Also, using this we can easily build hot reloading into Rails 6 application.
The webpacker gem provides integration with webpack and npm/yarn. Npm and yarn both famous for fast, reliable, and secure dependency management.
rails app:update. It will update the app to the latest version. During app updates, it will give you conflict over current files. You need to fix those files carefully.
We hope that this blog will be helpful to learn new features added in Rails 6 as well as the upgradation process. Ruby on Rails playing a very important role in Web Application Development and Web API Development. It will help you to build web applications within less time and cost compared to other technology.
#1 Ruby on Rails development company. Hire Ruby on rails developer or a team to build secure, scalable and complex web solutions with a quick turnaround time.
Looking for an attractive & user-friendly web developer? HourlyDeveloper.io, a leading web, and mobile app development company, offers web developers for hire through flexible engagement models. You can **[Hire Web...
The most satisfying thing beyond building something is to make it available to the world. Heroku is great for beginners because it’s a free and “simple” push-to-deploy system.
With the rapid development in technology, the old ways to do business have changed completely. A lot more advanced and developed ways are ...
David Heinemeier Hansson is the creator of Ruby on Rails, co-founder & CTO of Basecamp, best-selling author, Le Mans class-winning race car driver, family man, frequent podcast guest, and inspirational conference speaker.