aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal/responder.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2009-08-29 16:18:37 +0200
committerYehuda Katz <wycats@gmail.com>2009-08-29 11:01:00 -0500
commit684a6b3c71110b018199bf412e485189343e1f6d (patch)
tree3a004aedfa41b4dbe3d80f92c5d6be7348785837 /actionpack/lib/action_controller/metal/responder.rb
parentdbf20c2dbb5d1f2640517c468aa7c269d93414b9 (diff)
downloadrails-684a6b3c71110b018199bf412e485189343e1f6d.tar.gz
rails-684a6b3c71110b018199bf412e485189343e1f6d.tar.bz2
rails-684a6b3c71110b018199bf412e485189343e1f6d.zip
Attempt to render the template inside the responder, so it can be used for caching and pagination.
Signed-off-by: Yehuda Katz <wycats@gmail.com>
Diffstat (limited to 'actionpack/lib/action_controller/metal/responder.rb')
-rw-r--r--actionpack/lib/action_controller/metal/responder.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/metal/responder.rb b/actionpack/lib/action_controller/metal/responder.rb
index fc01a0924a..ac7f5dafe9 100644
--- a/actionpack/lib/action_controller/metal/responder.rb
+++ b/actionpack/lib/action_controller/metal/responder.rb
@@ -109,8 +109,10 @@ module ActionController #:nodoc:
# template.
#
def to_html
+ render
+ rescue ActionView::MissingTemplate
if get?
- render
+ raise
elsif has_errors?
render :action => default_action
else
@@ -118,12 +120,14 @@ module ActionController #:nodoc:
end
end
- # All others formats try to render the resource given instead. For this
- # purpose a helper called display as a shortcut to render a resource with
- # the current format.
+ # All others formats follow the procedure below. First we try to render a
+ # template, if the template is not available, we verify if the resource
+ # responds to :to_format and display it.
#
def to_format
- return render unless resourceful?
+ render
+ rescue ActionView::MissingTemplate
+ raise unless resourceful?
if get?
display resource