diff options
author | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-04-29 12:19:17 -0700 |
---|---|---|
committer | Yehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com> | 2009-05-01 17:31:01 -0700 |
commit | 4f68311685831b940936130203c240fa23525c84 (patch) | |
tree | 5fc1192c04bdef4b198a92c511f2a7a5d0e09bc3 /actionpack/lib/action_controller/abstract | |
parent | 1b459916039259383808625d1758a8bc4a4516d9 (diff) | |
download | rails-4f68311685831b940936130203c240fa23525c84.tar.gz rails-4f68311685831b940936130203c240fa23525c84.tar.bz2 rails-4f68311685831b940936130203c240fa23525c84.zip |
Finished implementing render :text in Base2
Diffstat (limited to 'actionpack/lib/action_controller/abstract')
-rw-r--r-- | actionpack/lib/action_controller/abstract/renderer.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/abstract/renderer.rb b/actionpack/lib/action_controller/abstract/renderer.rb index 37da2398ec..c1f420f7b4 100644 --- a/actionpack/lib/action_controller/abstract/renderer.rb +++ b/actionpack/lib/action_controller/abstract/renderer.rb @@ -1,6 +1,15 @@ require "action_controller/abstract/logger" module AbstractController + class AbstractControllerError < StandardError; end + class DoubleRenderError < AbstractControllerError + DEFAULT_MESSAGE = "Render and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and at most once per action. Also note that neither redirect nor render terminate execution of the action, so if you want to exit an action after redirecting, you need to do something like \"redirect_to(...) and return\"." + + def initialize(message = nil) + super(message || DEFAULT_MESSAGE) + end + end + module Renderer depends_on AbstractController::Logger @@ -17,6 +26,10 @@ module AbstractController end def render(options = {}) + unless response_body.nil? + raise AbstractController::DoubleRenderError, "OMG" + end + self.response_body = render_to_body(options) end |