mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Move the error raising to api_behavior.
This commit is contained in:
parent
ec73710c79
commit
149d13e1f0
1 changed files with 2 additions and 1 deletions
|
@ -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?
|
||||
|
|
Loading…
Reference in a new issue