📜 ⬆️ ⬇️

Rails 3.1: Release Candidate

Today, the first release candidate of RoR 3.1 was released, to which an official blog wrote an overview article about the key innovations in the upcoming version. To acquaint you with innovations, I translate with explanatory comments for those who have not heard anything about it. Further in the text italics my notes.


As I (DHH - translator's comment) and promised on RailsConf, we are finally ready to release Rails 3.1: Release Candidate. This is a fantastically exciting release. It has two new killer features and a lot more simply amazing improvements. To start killer features:

Asset pipeline

The key feature in 3.1 will be the asset pipeline running Sprockets 2.0 . It allows much more organically to organize CSS and JavaScript, including in plug-ins and engines (Engines). You can listen to the detailed description at my speech at RailsConf . By default, asset pipelines comes with SCSS for style sheets and CoffeeScript for JavaScript. A large amount of documentation on the way.
Asset Pipeline is a generic term for a new concept of working with the client part of an application. The general meaning of it is that now how the controllers, views and models are generated for your scaffolds, JS and CSS will also be created. This allows you to achieve a more convenient architecture and scatter dozens of files from public / javascript into modules. Rails themselves will take care of assembling all your client files into one and caching.
')
HTTP Streaming

This innovation will allow the browser to start downloading style sheets and javascript before the browser has finished generating the answer. The result is a noticeable increase in page speed. This is just an option that requires support from a web server, but the popular combination of nginx + unicorn is already ready to provide this. RailsCasts has a video about it, you can also see the documentation here .

The basic principle of operation is that the cached header (everything before </ head> for example) is given immediately after the request, the browser starts downloading the scripts and css specified in it, while the server makes requests to the database, etc.

jQuery is now defaulted

We made jQuery the default JavaScript framework that comes with Rails, but rolling back to Prototype is just as easy. They are installed using Bundler in the jquery-rails and prototype-rails gems. Just select the desired Gemfile and it just earns.

Other goodies:



You can also view a huge list of changes , as well as a small video overview on RailsCasts.

If you are creating a new application, it is better to use Ruby 1.9.2. Rails will support 1.8.x up to 4.0, but only for compatibility. Ruby 1.9.x is the trend. Join and enjoy the sudden burst of speed.

You can install Rails 3.1 RC as always with gem install rails --pre . Enjoy the release and send bugs to github . The final version is expected in a couple of weeks, if everything goes like clockwork.

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


All Articles