Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

SoluteLabs profile imageKaran Shah
Karan Shah forSoluteLabs

Posted on • Edited on • Originally published atsolutelabs.com

     

Rails 6 features: An Illustrated Version [INFOGRAPHIC]

Ruby on Rails, the goto framework for startups, launched its much-awaited 6.0 version on August 15, 2019. While the release notes are availablehere, we're presenting an illustrated version of the same.

Alt

Ruby on Rails has evolved over the years and has attracted its fair share oflove and hate - but one thing is for sure, with the kind of attention it's garnering and the number of people contributing to it - it's here to stay!

A huge number of expectations were riding on this Ruby on Rails 6 release and the following are the main highlights of the same!

  • Action Mailbox: Working with incoming email
  • Action Text: A modern WYSIWYG editor
  • SupportMultiple Databases with Active Record
  • Run Test Cases in Parallel, taking advantage of multiple cores
  • More ❤ for Javascript
  • Zeitwerk: a new code loader for Ruby

While the above is a list of major upgrades, there were a lot of minor improvements by a lot of people which shows how active the community around Rails is! Let's dig deeper into each of the updates.

Action Mailbox

Alt qandm
credits: qandm

Email is a powerful tool to communicate. Almost everyone needs to send emails - but increasingly many are also wanting to add a human touch with their users. In the world of bots, instead ofdo-not-reply emails, people are sending emails which can be replied to from real people.

Rails 6.0 now ships withinbuilt support for Mailgun, Mandrill, Postmark, and SendGrid. The emails are processed via Active Record and stored on the cloud through Active Storage and can be sent to one more multiple mailboxes.

What it means is that you can build your own mini Zendesk or Intercom with Rails with Action Mailbox and Action Cable

Action Text

I've seen a lot of WYSIWYG (What You See Is What You Get) editors and have found some issues with almost every one of them, none are perfect and while are minimalistic but lacking features, others are just plain bad.

Most WYSIWYG editors are wrappers around HTML'scontenteditable andexecCommand APIs and reverse engineer from there. DHH created this introductory video to explain Trix and it's inclusion in Rails 6 sometime a year ago:

The Action Text includes Active Storage-backed file and image processing, and a text-processing flow that ties it all together. This is especially useful if you're not using any UI framework likeReact with Rails.

Support for Multiple Databases

Today's applications are growing and supporting an enormous amount of users. An application hits limitations by scaling vertically (i.e. adding more RAM and Cores to an existing machine) and it's pragmatic to then scale horizontally (i.e. add more nodes aka machines) to support the growing userbase and this applies to not just app servers but also to Database Servers.

Alt Server Connected to Multiple Databases

Separating Databases and hence the content also adds security - so, in the worst-case scenario, one database being hacked won't lead to a total compromise of data.

This would also help if we want to keep some type of data in a NoSQL Database (such as location tracking data for trucks) and other data in an RDBMS format.

The support is nascent so while you can:

  • Have multiple primary databases with a replica for each (and automatically swap between them)

  • Automatically switch between databases depending upon the model on which you're working, and

  • The supporting rails tasks to handle multiple databases (create, drop, migrate DBs)

Stuff like the below is in the works:

  • Sharding
  • Joining across clusters
  • Load balancing replicas
  • Dumping schema caches for multiple databases

Run Test Cases in Parallel

Assuming that you're following TDD and BDD model for development (writing test cases before writing the logic), you would have noticed your test suites taking more and more time to run as the application grows.

Some of the apps that we have made took up to 30 minutes to run over a CI server. With multiple cores on your laptop and (hopefully) your CI - with the newcommit, you should be able to run your test cases more efficiently. While forking processes is the default method, threading is supported as well.

To enable parallelization to your test suites, just add the following to yourtest_helper.rb and voila!

class ActiveSupport::TestCase parallelize(workers: 2)end
Enter fullscreen modeExit fullscreen mode

There are options to set a different count for your CI server, you can dig into more detailshere.

More Love for Javascript

One thing is certain, Javascript is here to stay. Over the past few years, instead of fighting Javascript, the Rails community has embraced it with adding support for Vue, React and Angular in Rails 5.1.

Webpacker is now the default JavaScript bundler for Rails through the new app/javascript directory - although CSS and static assets will continue to work through the asset pipeline.

Zeitwerk

The new default code loader for Rails is here - Zeitwerk. It overcomes much of the limitations of the traditional loader, Zeitwerk can:

  • Autoload Code
  • Eager Load Code
  • Reload Code
  • Works with both: Gems and Apps

Listen to a nice talk by Xavier Noria for a deeper dive here:


Rails 6 new features

At SoluteLabs, we specialize in creating mobile and web apps for startups and we generally depend onRuby on Rails to build scalable, secure and fast-to-build backend for our apps.

Top comments(5)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
andrewbrown profile image
Andrew Brown 🇨🇦
I make free cloud certification courses
  • Email
  • Location
    Schreiber
  • Education
    Starfleet Academy
  • Work
    CEO at ExamPro
  • Joined

An excellent summary. I remember reading the Release Notes and I had missed all of this new support for databases. Setting up replicas prior was a pain. I'm glad to see they've baked in support.

CollapseExpand
 
atkaranshah profile image
Karan Shah
Entrepreneur, Traveller, Photographer, Passionate about new Startups and Tech, Always looking to connect with new people
  • Pronouns
    He/Him
  • Work
    CEO, Co-Founder @SoluteLabs
  • Joined

True, I'm working on a post for precisely that. We had a project which had multiple databases and then we migrated to Rails 6 and used this feature!

It was a godsend just a month before production release :)

CollapseExpand
 
guledali profile image
guledali
  • Joined

Amazing post! 👏👏

CollapseExpand
 
atkaranshah profile image
Karan Shah
Entrepreneur, Traveller, Photographer, Passionate about new Startups and Tech, Always looking to connect with new people
  • Pronouns
    He/Him
  • Work
    CEO, Co-Founder @SoluteLabs
  • Joined

Thank you :)

CollapseExpand
 
vikramchandra profile image
Vikram Sharma
Rails dev here.
  • Location
    India
  • Work
    Indie Hacker
  • Joined

Trix editor is a disappointment, especially from a SEO point ov view. If you need a basic text editor without worrying about SEO then go ahead and use Trix. But if you need a feature rich text editor then Trix is a disappointment. It does not even support the

tag out of the box. No option for adding H2 and below. No tables. All of these are important for SEO.

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Product Development, Simplified

Want to joinSoluteLabs and work on great products?

Join hands with a growing team and grow your career!

More fromSoluteLabs

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp