Whats new in Rails 5 ?

I watched the live stream of DHH’s Railsconf 2015 keynote yesterday and he was talking about Rails 5. Here is a quick look at the new things I found out thats coming in Rails 5.

1. Turbolinks 3

Consider you have a simple blogging application where you can add posts and comments. So there are basically 2 important sections of a blog page. One the blog post self and second are the comments. Section one is not going to change frequently. But section two which is comments will keep changing. So in turbolinks 3, you can tell the server to just update the comment section and keep the rest of the page as it is, as there is no need to refresh the whole page. This is an attempt to reduce the page load time even further and improve the experience for the user.

You can specify that this part of the page will not change by mentioning something like this “turbolink-permanent” in HTML.

2. ActionCable

This sounds interesting. This is an attempt to implement WebSockets the Rails way. Making it super easy to subscribe to a channel, sending and receiving messages over the channel.

Screen Shot 2015-04-21 at 8.06.09 pm

Screen Shot 2015-04-21 at 8.06.58 pm

The code looks like a controller code, so I think before_filters should also work with classes inheriting from ActionCable::Channel::Base.

P.S.
1. Code snippets are screenshots from DHH’s keynote live streaming.
2. This is just glimpse of what I took away from his keynote. I did not see the whole thing from the start, so I am not sure what else he talked about.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s