ActionCable Overview for Rails 5 Applications


On Thursdays I cover a technology topic that affects the developer community, and today I am going to given an ActionCable overview, which is a new feature in Rails 5.

I attended RailsConf 2015, where DHH gave a high level view of Rails 5 and discussed how it’s going to help bridge the gap between classic style Rails apps and the new client side MVCs. As no big surprise, being the founder of the Ruby on Rails framework, DHH is not a fan of SPA type apps.

If you’re new to web development, client side MVC or SPA applications are web apps that have a separate backend and front end. They usually use a JavaScript framework, such as AngularJS or React for the front end, and then a framework like Rails on the backend. I’ve personally never been a huge fan of client side MVCs when they’re built on top of a Rails application since I was not a fan of the extra work I had to do in order to get the two sides working together. However I’m not going to get into that debate, I have good developer friends who absolutely love client side MVCs and are very passionate about them and I have no issues with them, I just choose not to use them myself. However I think it’s important to discuss why client side MVCs have grown in popularity at the rate that they have over the past few years.

JavaScript frameworks such as AngularJS have powerful tools that allow applications to “magically” update. If you have ever had an application open and all of a sudden a message popped up, such as being on Facebook and having a friend send you a message, there’s a good chance that a client side MVC was used to accomplish this functionality. Up until now it was pretty difficult to build in features like this into a Rails application because they use standard, stateless RESTful requests.

However, in Rails 5, ActionCable looks to change this and bring real time data communication within reach for Rails developers without having to use an outside JavaScript framework.

ActionCable overview:

  • Who: it was developed by the Rails open source community.
  • What: it is a module in Rails 5 that leverages WebSockets to bring state to an application. This means that your users won’t have to change or refresh a page to get new data, it can be pushed to them from the application itself. Also note, it doesn’t require archaic forms of development, such as polling.
  • When: it is available now, and will be officially released when Rails 5 is considered the stable version.
  • Where: you can get it from the Rails github repository
  • Why: this is important since users are now expecting to have the ability for applications to be more dynamic, having stateless apps aren’t good enough anymore, and a tool like ActionCable will let you deliver real time data and updates to users while still within the Rails framework ecosystem.
  • How: ActionCable creates the concepts of Channels, where you can perform asynchronous data transfers, both requests and responses from within the application files.

I hope this was a helpful ActionCable overview for understanding what it is and how it can be helpful for your Rails applications, I’ll also include links to tutorials so you can try it out for yourself, and good luck with the coding!


ActionCable overview


  1. Mate thanks for the intro to action cable. i appreciate it! i heard about it in rails 5 and came here to find out what all the fuss was about.


Please enter your comment!
Please enter your name here