What is new in Rails 5 – Part 1

October 6, 2016 - 4 minutes read

So there is a lot of buzz around Rails 5, and you are still unclear what exactly it is going to deliver, and how promising it is. If so is the case, you are in the right place. In this article and the following article, we will cover the basic features that hopefully will be delivered in the final release of Rails 5. Rails 5 is aimed to be released in Fall 2015 as of this writing, though no official date yet.

Support for an API-only-rails-application:

So far, there are a lot of major improvements for Rails 5, and one of the best features is Rails support for an API only application.

With the advent of so many awesome front-end frameworks like AngularJS, BackboneJS, a number of times Rails is used as a backend web framework only, but at the same time, Rails has a lot of view files, Javascript and CSS code associated with it as well, so it kinda becomes messy to have a front-end framework embedded in a Rails application.

There are solutions to this problem like using Sinatra, a lightweight ruby framework for building APIs, but Sinatra misses a lot of things, and can’t replace Rails even for APIs.

The other solution for this problem is to use a gem called rails-api to make Rails act as an API web framework, and this is what has been done in Rails 5. rails-api gem has been merged in Rails 5, and it’s simpler than ever to utilize your Rails application as a pure API backend.

In Rails 5, all you have to do is write the following command, and boom!

So if you are thinking to have an SPW(Single Page Web applications) for you next project, Rails 5 can be the best candidate for having it as the backend platform.

Ruby 2.2.2 support for Rails 5:

Rails 5 is going to work with Ruby 2.2 or above, and since Ruby 2.2 brings a lot of new and amazing stuff to the Ruby community, Rails is going to be benefited a lot, and working with cutting edge Ruby has its own fruits as well.

Ruby 2.2 has a lot of security improvements. In previous versions of Ruby, passing symbols all over the place could become the cause of DOS attacks if those symbols aren’t garbage collected. But in Ruby 2.2, this and many other things have been improved, so it’s a win-win situation for Rails 5. Turbolinks 3: ===

Turbolinks are great when it comes to the speed of loading a page again and again, and with Turbolinks 3, this thing is even more robust.

Turbolinks allows your app to work as a SPA(Single Page Web application), with loading only the changing parts of your web page and caching the constant parts like headers, and footers, and thus, it has amazing effects on your application, and with Turbolinks 3 this thing is going to improve the overall user experience of your web application even further.

So that’s it for the first part of upcoming features in Rails 5. In the very next article in this series, we are going to see what are the minor yet effect changes/improvements in Rails 5. Till then, happy programming!