Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
76 lines (49 sloc) 2.13 KB


if you're using resources_controller and response_for, you probably want this!

What is it?

It's an alternate set of RC actions, written in response_for style.

How to use it?

For Rails 3.0 and newer just add it to your Gemfile:

gem 'response_for_rc_rails'

This will install resources_controller and response_for.

For older versions of rails you'll need to install the rails2 branch in vendor/plugins:

cd vendor/plugins
git clone git://
cd response_for_rc
git checkout rails2
rmdir -f .git

What else can I do with it?

If you're writing your own RC actions with responses, refactored in modules, you've probably noticed what an ass it is to add the responses (you need to stick it in self.included and add them on the including class, etc, etc).

Recent developments on response_for resources_controller, and now response_for_rc, mean you can now do stuff like this

module MyActions
  extend RcResponseFor::ResponsesModule # <= this baby gives your module the ability to understand response_for
                                        # <= and to add responses to any including controller
  def new
    # your new

  response_for :new do |format|
    # your new response

  def show
    # your show

  response_for :show do |format|
    # your show response

  # and others

# later

class FoosController < ApplicationController
  resources_controller_for :foos, :actions => MyActions

  # you get all of the above actions and responses

# also works with :only and :except
class BarsController < ApplicationController
  resources_controller_for :bars, :actions => MyActions, :only => [:new]

  # only get new and new response

# if you want to set your own actions globally (as the default, look in init.rb to see how)


You need resources_controller (gem rc_rails) and response_for (gem response_for_rails). These are installed for you if using bundler.

Something went wrong with that request. Please try again.