A set of responders modules to dry up your Rails 3 app. If you are interested in the version to be used with Rails 2.3 together with Inherited Resources, please check this branch instead:

config.responders.flash_keys = [ :success, :failure ]


  Responders::FlashResponder.flash_keys = [ :success, :failure ]

Configuring your own responder

The first step is instal responders gem and configure it in your application:

gem install responders

Responders only provides a set of modules, to use them, you have to create your own responder. This can be done inside the lib folder for example:

# lib/app_responder.rb
class AppResponder < ActionController::Responder
  include Responders::FlashResponder
  include Responders::HttpCacheResponder

And then you need to configure your application to use it:

# app/controllers/application_controller.rb
require "app_responder"

class ApplicationController < ActionController::Base
  self.responder = AppResponder
  respond_to :html

Or, for your convenience, just do:

rails generate responders:install

Controller method

This gem also includes the controller method 'responders', which allows you to cherry-pick which responders you want included in your controller.

class InvitationsController < ApplicationController
  responders :flash, :http_cache


This gem also includes a responders controller generator, so your scaffold can be customized to use respond_with instead of default respond_to blocks. Installing this gem automatically sets the generator.

Bugs and Feedback

If you discover any bugs or want to drop a line, feel free to create an issue on GitHub.

MIT License. Copyright 2010 Plataforma Tecnologia.