ImplicitRespondTo ================= Use #{action_name}_#{type} methods to automatically respond_to when possible. Yield from the presentation method to the original action. class PeopleController < ApplicationController # Accept: text/html def update_html yield redirect_to person_url(@person) rescue ActiveRecord::RecordNotSaved flash[:error] = "Error saving #{@person.name}" render :action => 'edit' end # Accept: application/xml def update_xml yield header['Location'] = person_url(@person) render :xml => @person.to_xml rescue ActiveRecord::RecordNotSaved render :xml => @person.errors.to_xml, :status => '400 Bad Request' end protected def update @person.attributes = params[:person] @person.save! end end