Get Support

info@technacreous.com

What’s New in Ruby On Rails 6

What’s New in Ruby On Rails 6

With the official release of Rails 6 just around the corner, we round up all the major new features coming your way. It is an exciting release due to some big features coming upstream from the Basecamp and GitHub projects. Amongst the many minor updates, useful tweaks and bug fixes, Rails 6 will ship with two completely new frameworks: ActionText and ActionMailbox, and two big scalable-by-default features: parallel testing and multiple database support. So set your Gemfile to get Rails 6.0.0.rc1 and let’s get started!

Multiple Database Support

Rails now supports switching between multiple databases. This is a very small change to the codebase, but it’s a feature that many developers are going to find really useful. The contribution came upstream from the GitHub developers, and provides an API for easily switching between multiple databases.

Possible use cases for this new feature would be having a read-only version of your database to use in areas known for having slow queries. Or another example would be if you had the need to write to different databases depending on which controller is executing.

First of all, you need to add the extra databases to your database.yml config file like this:

development:
main:
<<: *defaults
database: main_db
slow_queries:
<<: *defaults
database: readonly_main_db

Add a Comment

Your email address will not be published.