aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-12-12 18:48:34 -0600
committerJoshua Peek <josh@joshpeek.com>2009-12-12 18:48:34 -0600
commit4b4e517bf1d51e749a6cedb2dd5203b19ab080e5 (patch)
tree13fa42ddca7d1c9c4c3ce1f2fe6ccba3658d75d3 /actionpack/lib
parent018dafe574d370165547516ffef43394e11ab4da (diff)
downloadrails-4b4e517bf1d51e749a6cedb2dd5203b19ab080e5.tar.gz
rails-4b4e517bf1d51e749a6cedb2dd5203b19ab080e5.tar.bz2
rails-4b4e517bf1d51e749a6cedb2dd5203b19ab080e5.zip
Relocate AbstractController exceptions into their proper parent modules
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/abstract_controller.rb7
-rw-r--r--actionpack/lib/abstract_controller/base.rb4
-rw-r--r--actionpack/lib/abstract_controller/exceptions.rb12
-rw-r--r--actionpack/lib/abstract_controller/rendering_controller.rb20
4 files changed, 17 insertions, 26 deletions
diff --git a/actionpack/lib/abstract_controller.rb b/actionpack/lib/abstract_controller.rb
index 688a2fe31c..af3623e97e 100644
--- a/actionpack/lib/abstract_controller.rb
+++ b/actionpack/lib/abstract_controller.rb
@@ -11,11 +11,4 @@ module AbstractController
autoload :LocalizedCache
autoload :Logger
autoload :RenderingController
-
- # === Exceptions
- autoload_at "abstract_controller/exceptions" do
- autoload :ActionNotFound
- autoload :DoubleRenderError
- autoload :Error
- end
end
diff --git a/actionpack/lib/abstract_controller/base.rb b/actionpack/lib/abstract_controller/base.rb
index f5b1c9e4d1..70b5f5b3ef 100644
--- a/actionpack/lib/abstract_controller/base.rb
+++ b/actionpack/lib/abstract_controller/base.rb
@@ -1,4 +1,6 @@
module AbstractController
+ class Error < StandardError; end
+ class ActionNotFound < StandardError; end
class Base
attr_internal :response_body
@@ -74,7 +76,7 @@ module AbstractController
abstract!
# Calls the action going through the entire action dispatch stack.
- #
+ #
# The actual method that is called is determined by calling
# #method_for_action. If no method can handle the action, then an
# ActionNotFound error is raised.
diff --git a/actionpack/lib/abstract_controller/exceptions.rb b/actionpack/lib/abstract_controller/exceptions.rb
deleted file mode 100644
index b671516de1..0000000000
--- a/actionpack/lib/abstract_controller/exceptions.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-module AbstractController
- class Error < StandardError; end
- class ActionNotFound < 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
diff --git a/actionpack/lib/abstract_controller/rendering_controller.rb b/actionpack/lib/abstract_controller/rendering_controller.rb
index 777e515d60..d6d2c3e191 100644
--- a/actionpack/lib/abstract_controller/rendering_controller.rb
+++ b/actionpack/lib/abstract_controller/rendering_controller.rb
@@ -1,6 +1,14 @@
require "abstract_controller/logger"
module AbstractController
+ 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
+
module RenderingController
extend ActiveSupport::Concern
@@ -21,7 +29,7 @@ module AbstractController
# An instance of a view class. The default view class is ActionView::Base
#
# The view class must have the following methods:
- # View.for_controller[controller] Create a new ActionView instance for a
+ # View.for_controller[controller] Create a new ActionView instance for a
# controller
# View#render_partial[options]
# - responsible for setting options[:_template]
@@ -152,12 +160,12 @@ module AbstractController
module ClassMethods
def clear_template_caches!
end
-
+
# Append a path to the list of view paths for this controller.
#
# ==== Parameters
- # path<String, ViewPath>:: If a String is provided, it gets converted into
- # the default view path. You may also provide a custom view path
+ # path<String, ViewPath>:: If a String is provided, it gets converted into
+ # the default view path. You may also provide a custom view path
# (see ActionView::ViewPathSet for more information)
def append_view_path(path)
self.view_paths << path
@@ -166,8 +174,8 @@ module AbstractController
# Prepend a path to the list of view paths for this controller.
#
# ==== Parameters
- # path<String, ViewPath>:: If a String is provided, it gets converted into
- # the default view path. You may also provide a custom view path
+ # path<String, ViewPath>:: If a String is provided, it gets converted into
+ # the default view path. You may also provide a custom view path
# (see ActionView::ViewPathSet for more information)
def prepend_view_path(path)
clear_template_caches!