One of the most important things to know about Rails 4.1 is that even the beta version is stable enough for some companies to use it in production. For example,Basecamp began Rails 4.1 beta1. Other important features from the release notes include the Spring application preloader, changes to config/secrets.yml, Action Pack variants, and Action Mailer previews. You can find the full list of changes by reviewing the list of commits in the GitHub repository for Rails.

Spring application preloader

In previous versions of Rails you would need to setup Spring if you wanted to keep your applications active between tests, rake tasks, and migrations. Not having Spring, your applications would need to boot for each of these events. When Spring was configured, the development process was sped up because the application would stay running in the background. Now, in Rails 4.1, new applications will automatically take advantage of Spring to speed up development and keep your application running in the background.

config/secrets.yml

In the config folder of Rails 4.1, you will now find a secrets.yml file. This is used to manage the secret_key_base for your application. Additionally, this file can be used to store other keys like the ones used for external APIs.

Action Pack variants

Depending on the devices accessing your application, you may want to render different HTML, XML, or JSON. This allows you to configure your app to look great on different devices like tablets, phones, and laptops. The variant can be set in a before_action and your app can respond to variants in the same way it responds to formats. You will also need to provide templates for each variant and format.

Action Mailer previews

Creating an Action Mailer was cumbersome in previous versions of Rails. Previously, you would need to send test emails to see what was being delivered to a client and to get the formatting right. Now, in Rails version 4.1, you can use Action Mailer previews to see what an email will look like by visiting a special URL. By default, these are located at test/mailers/previews, but that can be changed with the preview_path during configuration.

Get the Honeybadger newsletter

Each month we share news, best practices, and stories from the DevOps & monitoring community—exclusively for developers like you.
    author photo
    Starr Horne

    Starr Horne is a Rubyist and Chief JavaScripter at Honeybadger.io. When she's not neck-deep in other people's bugs, she enjoys making furniture with traditional hand-tools, reading history and brewing beer in her garage in Seattle.

    More articles by Starr Horne
    An advertisement for Honeybadger that reads 'Turn your logs into events.'

    "Splunk-like querying without having to sell my kidneys? nice"

    That’s a direct quote from someone who just saw Honeybadger Insights. It’s a bit like Papertrail or DataDog—but with just the good parts and a reasonable price tag.

    Best of all, Insights logging is available on our free tier as part of a comprehensive monitoring suite including error tracking, uptime monitoring, status pages, and more.

    Start logging for FREE
    Simple 5-minute setup — No credit card required