📜 ⬆️ ⬇️

What's new in Rails 5.0. You can plan a move

The release of Rails 5.0 is scheduled for March 16, it's time to find out what is new and tasty in the new version of the rails (except for the new logo and design of their official website, I mean).
image

Initially, the release of Rails 5.0 was scheduled for spring 2015 and shifted many times, most recently from February 23 to March 16, 2016 . That is, perhaps this is not the last postponement. Nevertheless, Rails 5.0 currently has beta3 status and works on Basecamp production.

First formal changes


And big pieces of functionality

Turbolinks 5

The current version of turbolinks updates the entire page contents via ajax without re-accessing static css, js, etc. files. The new version allows you to selectively change the contents of individual parts of the web page (through partials), and this can be done at the initiative of the server.

Action Cable

Websockets support is finally implemented, now you can do full-fledged single page applications without dancing with a tambourine. Channels, subscribers to them on the client side, and so on. Very comfortably.
')
Wonderful video tutorial on using Action Cable - web-based chat on Rails without refreshing the page.

API mode

Now it is possible to make an application without HTML and JS parts by default - much faster and easier.
rails new backend --api

An application is created that is immediately configured to work with JSON, not HTML.

Sprockets 4

Added app / assets / config / manifest.js file to manage precompilation of static files.
// JS and CSS bundles
//
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css

// Images and fonts so that views can link to them
//
//= link_tree ../fonts
//= link_tree ../images

Its location and format (js or yml) are also discussed, of course, with the final release it will be clear.

A little sugar

It is actually a lot, like a lot and small changes, but I liked these few:


Result

They promise a 20-30% increase in performance. As I understand it, mainly due to the massive use of frozen strings (and bulk code optimization, of course).

Install the latest beta

 git clone --depth 1 http://github.com/rails/rails cd rails bundle railties/exe/rails new --edge appname cd appname bundle bundle exec rails s 


Read

http://blog.michelada.io/whats-new-in-rails-5
https://medium.com/evil-martians/the-rails-5-post-9c76dbac8fc#.9p0fpry5o
The newest video podcast about changes (with examples)

Source: https://habr.com/ru/post/278969/


All Articles