Rails 5 is one of the biggest release from the Ruby on Rails community since June 2013. The latest V5 unfolds an impressive range of features and changes. However, the community not only ensure that Rails 5 stacked with new components to stay up with trends, additionally this framework is ready to grasp and embrace the future of technology.
From the start, Rails have proven it for being available as the easiest way to get Ruby on the Web. Though many other options have arrived since then, Rails still maintains the lead when it comes to choosing a framework. With V5, does the technology will acquire new milestones?
Here, we lift the lid about the most exciting things about this new version.
- Action Cable
Action Cable is the banner feature of Rails 5. Action Cable is a feature used to stretch out Rails via Websockets to add real-time message passing functionality. Previously, you were pondering which framework to use for a web app that relies on ongoing components. Off the chance, you are ending up to use NodeJs and SocketIO or other comparable framework, as such frameworks allow you to add up ongoing components to your application like chat messages or notifications.
That makes Action Cable really amazing, since you can send data from your Rails server to every associated user and update whatever they find in their browser. The most obvious use case would be something like a chat app.
- Use Rails Just For Backends With API Mode
Another enormous change Rails 5 witness is API mode. Previously, Rails framework used for web application that runs totally in the web browser. Whereas Rails 5 bring functionality and empower developers made effective and robust backend principle to interact with data and to integrate it with the frontend of the web application.
These days, however, several use cases whereby the frontend and backend of an application are isolated. Mostly, this applied to smartphone or tablet apps. For instance, you write your native app for Android or iOS but you want it to interact with a server to save data online. On the off chance that this communication is all you require your backend to do, you don’t need any HTML pages. You essentially require a solid backend your mobile app can connect to.
Well, with Rails 5 you can do precisely that.
While working with Rails 5, it would be possible for you to create Rails application in API mode that implies it will be created without any of the things you typically require if you somehow happened to run your a Rails application specifically in the browser. This incorporates, for instance, the “views” and “assets” parts of Rails applications. After that, you could communicate with Rails through “RESTful” links and transfer data in simple JSON.
With this new version, Turbolinks offers more stability along with added features. Though there were groans in the audience when DHH announced, again, his love for Turbolinks and their inclusion in Rails 5. If you get fret after reading this, you don’t need to. Because Turbolinks is not revolutionary (but rather evolutionary) step forward.
- Rails 5 only supports 2.2.2 and above
This is important – Rails 5 only support versions of Ruby 2.2.2 or higher. Ruby 2.2 introduces several new features and performance improvements for the increasingly diverse and expanding demands for Ruby. As Ruby progresses as a language, backwards compatibility needs to be sacrificed for few features. Older versions can’t be supported indefinitely. Rails is no different here.
What Else Is New?
- Rails 5 incorporates a whole number of big and small changes. In any case, just to give you an idea of some of the other things to look out for, here are a couple of additional to remember
- Rails has a new logo and welcome screen when you first create your app
- Rails uses Puma as the default web server now instead of Webrick
- Turbolinks 5 promises to load your pages much faster than before
- Use built-in helper methods like “on_weekday” or “on_weekend” to check whether a date is a weekday or on a weekend
What’s your most loved piece of Rails 5? Did we miss something that you believe is fundamental on the list of most imperative elements? It would be ideal if you let us know in the comments.