BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

Rails 4.1 Improves Boot Time and Responsive Layouts

| by Mirko Stocker on Apr 09, 2014. Estimated reading time: 1 minute |

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 Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT