From 149d13e1f0d157a48c04c8b3944f09ce463e9416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Wed, 7 Apr 2010 16:18:13 +0200 Subject: [PATCH] Move the error raising to api_behavior. --- actionpack/lib/action_controller/metal/responder.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/actionpack/lib/action_controller/metal/responder.rb b/actionpack/lib/action_controller/metal/responder.rb index d97c10a293..6ad9a23542 100644 --- a/actionpack/lib/action_controller/metal/responder.rb +++ b/actionpack/lib/action_controller/metal/responder.rb @@ -135,7 +135,6 @@ module ActionController #:nodoc: def to_format default_render rescue ActionView::MissingTemplate => e - raise unless resourceful? api_behavior(e) end @@ -154,6 +153,8 @@ module ActionController #:nodoc: # This is the common behavior for "API" requests, like :xml and :json. def api_behavior(error) + raise error unless resourceful? + if get? display resource elsif has_errors?