A Look at Rails 5

     

look-at-rails-5

From the start, Rails was praised for being the easiest way to get Ruby on the web. Not only has it solidified itself as the easiest option, it’s become the best. Since then, many other options have arrived, but Rails is still the de facto framework for Ruby developers.

On June 30, 2016, Rails 5.0.0 was released. Since then, Ruby has spent more than 4,100 commits to make things simpler for users. Additionally, it’s released numerous iterations, including Rails 5.1.2, which was released on June 26, 2017.

To help illustrate just how far we’ve come since Ruby 4, let’s take a look at some of the highlights of Ruby 5.

TurboLinks 3

TurboLinks are a method for making your application feel a bit faster by using JavaScript to replace portions of content instead of reloading an entire page. But TurboLinks can also make an application a little heavy on client-side JavaScript, which can sometimes mean unresponsiveness or slowdowns. In addition, some devs struggle to get the performance boosts promised by TurboLinks.

Turbolinks have been part of Rails since version 4, but version 5 takes advantage of the more advanced TurboLinks 3. This streamlines the process and makes use of Rack middleware and HTML5 custom data attributes.

If you are familiar with the functionality of TurboLinks in your application, do not fret! Things are not changing significantly. TurboLinks 3 will be an evolutionary step towards better speed and better rendering.

Action Cable

The biggest news when Ruby 5 was first announced was the introduction of Action Cable. Action Cable is a feature used to extend Rails via WebSockets to add real-time message passing functionality. This full-stack offering provides both a client-side JavaScript framework and a server-side Ruby framework.

As of April 27, 2017, there were several changelogs for ActionCable, which can be accessed here.

CoffeeScript

Baked into Rails in version 3, CoffeeScript was made the default JavaScript option when using Rails. Some developers believed this went too far and were concerned that any default effectively meant a “must use” for Rails developers—especially devs that work on many projects.

Two versions later, CoffeeScript is still around as a default option, and the decision has gained a wider acceptance. For some people, that’s because the “must use” fear didn’t pan out, and for others, it’s because they tried CoffeeScript and they liked it.

CoffeeScript is included by default with JavaScript, and this won’t be going away anytime soon.

Ruby Version Support

When it debuted, Rails 5 only supported Ruby versions 2.2.1 and higher. As Ruby progresses as a language, backwards compatibility needs to be sacrificed for new features and older versions can’t be supported indefinitely. While Rails is no different, it made the sensible decision of only supporting the most widely used version, starting with 2.2.1 and including all stable releases after.

Because of this, it is unlikely that someone using Ruby 1.9.3 would want to move to Rails 5. It’s possible they will remain on a lower version until some other external factor forces an upgrade and a refactoring of the code. For some dev shops, that may not happen for years, which is perfectly understandable.

For some, this is a barrier to Rails 5. For others, it is an opportunity upgrade and improve an application that may be in need of some love.

Conclusion

Rails 5 is here to stay.

So far, we’ve appreciated the Turbolinks upgrade for better rendering, Action Cable for better real-time message handling, more CoffeeScript, and moving forward with the Ruby ecosystem.

If you can upgrade, upgrading is your best option. Though, depending on how much time you have, it may be a good idea to let the early adopters kick the tires.

What are your thoughts on Rails 5? Leave us a comment!

Why Engine Yard Is Better Than Do It Yourself

PJ Hagerty

 
Programmer, writer, musician, random person! Chaotic Neutral #rubykaraoke cofounder
Find me on:

Comments

Subscribe Here!