What everybody ought to know about Ruby on Rails 4.1

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. 

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.

What to do next:
  1. Sign up for a FREE Honeybadger account
    Honeybadger helps you find and fix errors before your users can even report them. Get set up in minutes and check monitoring off your to-do list.
    Try Honeybadger for FREE
  2. 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
    Stop wasting time manually checking logs for errors!

    Try the only application health monitoring tool that allows you to track application errors, uptime, and cron jobs in one simple platform.

    • Know when critical errors occur, and which customers are affected.
    • Respond instantly when your systems go down.
    • Improve the health of your systems over time.
    • Fix problems before your customers can report them!

    As developers ourselves, we hated wasting time tracking down errors—so we built the system we always wanted.

    Honeybadger tracks everything you need and nothing you don't, creating one simple solution to keep your application running and error free so you can do what you do best—release new code. Try it free and see for yourself.

    Try Honeybadger for FREE
    No credit card needed - Simple 5-minute setup

    Learn more

    "We've looked at a lot of error management systems. Honeybadger is head and shoulders above the rest and somehow gets better with every new release."
    — Michael Smith, Cofounder & CTO of YvesBlue

    Honeybadger is trusted by top companies like: