Skip to content

Instantly share code, notes, and snippets.

@jacqui
Created January 12, 2010 20:53
Show Gist options
  • Save jacqui/275598 to your computer and use it in GitHub Desktop.
Save jacqui/275598 to your computer and use it in GitHub Desktop.
rescue_from ActiveResource::BadRequest, :with => :ar_bad_request
def ar_bad_request(e)
@message = e.message
respond_to do |format|
format.html { render :template => "#{RAILS_ROOT}/public/something.html", :layout => false, :status => 400}
format.xml { render :template => "api/something.xml", :status => 400, :content_type => 'application/xml' }
format.json { render :template => "api/something.json", :status => 400, :content_type => 'application/json' }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment