0
@@ -12,33 +12,24 @@ As of version 0.2.0, response_for's functionality can be summed up in one senten
0
"response_for allows you to specify default responses for any action (or before filter) that doesn't render or redirect"
0
-Versions prior to 0.2 are tagged with 0.1.
0
-There is a branch for rails 2.0 users on this release. If you are using rails 2.0, then you want the 0.1-stable-rails2.0 branch. If you are
0
-using rails >= 2.1 then use the 0.1-stable branch
0
+Actions typically do two things - interact with models, and provide a repsonse. The above simple idea allows you to decouple these
0
+two functions (where appropriate), which means abstraction of common patterns becomes possible.
0
class FooController < ApplicationController
0
- @foo = Foo.find(params[:id])
0
+ # default response - render html
0
- # this controller needs to respond_to fbml on index, and
0
- # js, html and xml (templates) on index and show
0
+ # this controller needs to respond_to fbml on index.
0
+ # Using response_for, we don't need to repeat '@foos = Foo.find(1)'
0
class SpecialFooController < FooController
0
response_for :index do |format|
0
format.fbml { render :inline => turn_into_facebook(@foos) }
0
- response_for :index, :show, :types => [:html, :xml, :js]
0
@@ -53,3 +44,9 @@ RSpec is used for testing, so the tests are in <tt>spec/</tt> rather than
0
garlic (at http://github.com/ianwhite/garlic) is used for CI. To run the CI suite have a look at
0
+== Previous Versions: 0.1
0
+There is a branch for rails 2.0 users on this release. If you are using rails 2.0, then you want the 0.1-stable-rails2.0 branch. If you are
0
+using rails >= 2.1 then use the 0.1-stable branch