BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Rails 4.1 Improves Boot Time and Responsive Layouts

Rails 4.1 Improves Boot Time and Responsive Layouts

This item in japanese

Lire ce contenu en français

After two release candidates, the Rails team has just released Rails 4.1.0. The point release is meant to signify that the changes are backwards-compatible and upgrading should be painless.

Rails 4.1 includes Spring (no relation to the JVM application framework) to speed up development by preloading your application: "With Spring, your application is a persistent process that can be reused across commands, so only the first run is slow. And we automatically detect code changes, and reload just those parts". After a simple setup, your rake and rails commands will take advantage of the preloading.

In today's mobile world, websites should respond to different screen form-factors. Action Pack Variants helps you render different templates depending on the user's device category, like how you can already respond with different file formats: 

respond_to do |format|
  format.html do |html|
    html.tablet # renders app/views/projects/show.html+tablet.erb
    html.phone { extra_setup; render ... }
  end
end

Basecamp has been using this technique to serve desktop browsers, mobile browsers and native mobile apps from a single Rails application.

Rails 4.1 also brings new features to some of its components: Active Record now supports Enums that are mapped to simple integer values in the database. Action Mailer has gained support for previewing email templates in the browser, instead of having to deliver them to get a preview.

To improve the security of your applications, the keys and tokens your application needs can now be stored at a central place in config/secrets.yml.

If you plan to upgrade your application, have a look at the migration guide that gives you detailed instructions on all the new features. And even though it's a minor release, there were some removals, so make sure to check them before upgrading. To learn more about all the new features, have a look at Godfrey Chan's blog post.

Rate this Article

Adoption
Style

BT