aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/abstract/base.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-05-28 09:49:02 -0500
committerJoshua Peek <josh@joshpeek.com>2009-05-28 09:49:02 -0500
commitde203245afd2bbf7f93f3241fcf3a71a88101d47 (patch)
tree3fbae223e10f0e50da6d9fdfc2c70a742c34ac26 /actionpack/lib/action_controller/abstract/base.rb
parentdd98280e38d640f5724887cf8a715b79f0439d2d (diff)
downloadrails-de203245afd2bbf7f93f3241fcf3a71a88101d47.tar.gz
rails-de203245afd2bbf7f93f3241fcf3a71a88101d47.tar.bz2
rails-de203245afd2bbf7f93f3241fcf3a71a88101d47.zip
Revert "Revert "Whitespace!""
This reverts commit 0cac68d3bed3e6bf8ec2eb994858e4a179046941.
Diffstat (limited to 'actionpack/lib/action_controller/abstract/base.rb')
-rw-r--r--actionpack/lib/action_controller/abstract/base.rb34
1 files changed, 16 insertions, 18 deletions
diff --git a/actionpack/lib/action_controller/abstract/base.rb b/actionpack/lib/action_controller/abstract/base.rb
index bbd42623d3..87083a4d79 100644
--- a/actionpack/lib/action_controller/abstract/base.rb
+++ b/actionpack/lib/action_controller/abstract/base.rb
@@ -2,28 +2,27 @@ require 'active_support/core_ext/module/attr_internal'
module AbstractController
class Error < StandardError; end
-
+
class DoubleRenderError < Error
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
-
+ end
+
class Base
-
attr_internal :response_body
attr_internal :response_obj
attr_internal :action_name
class << self
- attr_reader :abstract
-
+ attr_reader :abstract
+
def abstract!
@abstract = true
end
-
+
alias_method :abstract?, :abstract
def inherited(klass)
@@ -34,13 +33,13 @@ module AbstractController
def subclasses
@subclasses ||= []
end
-
+
def internal_methods
controller = self
controller = controller.superclass until controller.abstract?
controller.public_instance_methods(true)
end
-
+
def process(action)
new.process(action.to_s)
end
@@ -48,7 +47,7 @@ module AbstractController
def hidden_actions
[]
end
-
+
def action_methods
@action_methods ||=
# All public instance methods of this class, including ancestors
@@ -61,13 +60,13 @@ module AbstractController
hidden_actions
end
end
-
+
abstract!
-
+
def initialize
self.response_obj = {}
end
-
+
def process(action)
@_action_name = action_name = action.to_s
@@ -78,17 +77,16 @@ module AbstractController
process_action(action_name)
self
end
-
+
private
-
def action_methods
self.class.action_methods
end
-
+
def action_method?(action)
action_methods.include?(action)
end
-
+
# It is possible for respond_to?(action_name) to be false and
# respond_to?(:action_missing) to be false if respond_to_action?
# is overridden in a subclass. For instance, ActionController::Base
@@ -114,4 +112,4 @@ module AbstractController
end
end
end
-end \ No newline at end of file
+end