This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
response_for / README.rdoc
| f0b98bf1 » | ian | 2007-10-18 | 1 | = response_for | |
| 2 | |||||
| 570f798d » | ian | 2007-10-23 | 3 | response_for (see Ardes::ResponseFor::ClassMethods) allows you to decorate the respond_to block of actions on sublcassed controllers. This works nicely with http://plugins.ardes.com/doc/resources_controller | |
| 4 | |||||
| 9dc94651 » | ianwhite | 2008-09-13 | 5 | == Current Version 0.2-stable | |
| 9eb9e429 » | ianwhite | 2008-04-30 | 6 | ||
| 9dc94651 » | ianwhite | 2008-09-13 | 7 | Version 0.2-stable of response_for has BC-breaking API changes, has vastly simplified internals, and is supported only for Rails >= 2.1.x. | |
| 9eb9e429 » | ianwhite | 2008-04-30 | 8 | ||
| 9dc94651 » | ianwhite | 2008-09-13 | 9 | Version 0.2.0 was released on Sept 14th 2008. | |
| 10 | |||||
| 11 | As of version 0.2.0, response_for's functionality can be summed up in one sentence: | ||||
| 12 | |||||
| 13 | "response_for allows you to specify default responses for any action (or before filter) that doesn't render or redirect" | ||||
| 37e2d2ed » | ianwhite | 2008-09-13 | 14 | ||
| 15 | == Version 0.1 | ||||
| 16 | |||||
| 17 | Versions prior to 0.2 are tagged with 0.1. | ||||
| 18 | |||||
| 19 | 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 | ||||
| 20 | using rails >= 2.1 then use the 0.1-stable branch | ||||
| 9eb9e429 » | ianwhite | 2008-04-30 | 21 | ||
| 570f798d » | ian | 2007-10-23 | 22 | === Example | |
| 23 | |||||
| 24 | class FooController < ApplicationController | ||||
| 25 | def index | ||||
| 26 | @foos = Foo.find(:all) | ||||
| 27 | end | ||||
| 28 | |||||
| 29 | def show | ||||
| 30 | @foo = Foo.find(params[:id]) | ||||
| 31 | end | ||||
| 32 | end | ||||
| 33 | |||||
| 34 | # this controller needs to respond_to fbml on index, and | ||||
| 35 | # js, html and xml (templates) on index and show | ||||
| 36 | class SpecialFooController < FooController | ||||
| 37 | response_for :index do |format| | ||||
| 38 | format.fbml { render :inline => turn_into_facebook(@foos) } | ||||
| 39 | end | ||||
| 40 | |||||
| 41 | response_for :index, :show, :types => [:html, :xml, :js] | ||||
| 42 | end | ||||
| 41b2cc18 » | ianwhite | 2008-04-30 | 43 | ||
| f0b98bf1 » | ian | 2007-10-18 | 44 | === Specs and Coverage | |
| 45 | |||||
| 41b2cc18 » | ianwhite | 2008-04-30 | 46 | * The SPECDOC lists the specifications | |
| 0aeceda2 » | ianwhite | 2008-06-05 | 47 | * Coverage is 100% (C0), and the spec suite is quite comprehensive | |
| 41b2cc18 » | ianwhite | 2008-04-30 | 48 | ||
| f0b98bf1 » | ian | 2007-10-18 | 49 | RSpec is used for testing, so the tests are in <tt>spec/</tt> rather than | |
| 50 | <tt>test/</tt> Do rake --tasks for more details. | ||||
| 51 | |||||
| 41b2cc18 » | ianwhite | 2008-04-30 | 52 | === Continuous Integration | |
| 53 | |||||
| 54 | garlic (at http://github.com/ianwhite/garlic) is used for CI. To run the CI suite have a look at | ||||
| 55 | garlic_example.rb | ||||








