aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/new_base/base.rb
diff options
context:
space:
mode:
authorYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-05-15 17:49:11 -0700
committerYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-05-15 17:49:11 -0700
commit5a45446cff0daf4ca747257a8779dcd5d9cae1d7 (patch)
tree23a7ff81593e1d1060f01f340852fd8477c825c4 /actionpack/lib/action_controller/new_base/base.rb
parent7e10504bdeab14ea70a942110a1b1ef6d8467ed3 (diff)
downloadrails-5a45446cff0daf4ca747257a8779dcd5d9cae1d7.tar.gz
rails-5a45446cff0daf4ca747257a8779dcd5d9cae1d7.tar.bz2
rails-5a45446cff0daf4ca747257a8779dcd5d9cae1d7.zip
Ported Rescuable to new base
Diffstat (limited to 'actionpack/lib/action_controller/new_base/base.rb')
-rw-r--r--actionpack/lib/action_controller/new_base/base.rb50
1 files changed, 29 insertions, 21 deletions
diff --git a/actionpack/lib/action_controller/new_base/base.rb b/actionpack/lib/action_controller/new_base/base.rb
index 3ee17769a8..c25ffd5c84 100644
--- a/actionpack/lib/action_controller/new_base/base.rb
+++ b/actionpack/lib/action_controller/new_base/base.rb
@@ -12,14 +12,40 @@ module ActionController
include ActionController::Renderer
include ActionController::Layouts
include ActionController::ConditionalGet
-
+
# Legacy modules
include SessionManagement
include ActionDispatch::StatusCodes
-
+
# Rails 2.x compatibility
include ActionController::Rails2Compatibility
-
+
+ # TODO: Extract into its own module
+ # This should be moved together with other normalizing behavior
+ module ImplicitRender
+ def process_action(method_name)
+ ret = super
+ render if response_body.nil?
+ ret
+ end
+
+ def _implicit_render
+ render
+ end
+
+ def method_for_action(action_name)
+ super || begin
+ if view_paths.find_by_parts?(action_name.to_s, {:formats => formats, :locales => [I18n.locale]}, controller_path)
+ "_implicit_render"
+ end
+ end
+ end
+ end
+
+ include ImplicitRender
+
+ include ActionController::Rescue
+
def self.inherited(klass)
::ActionController::Base.subclasses << klass.to_s
super
@@ -113,23 +139,5 @@ module ActionController
super(url, status)
end
-
- def process_action(method_name)
- ret = super
- render if response_body.nil?
- ret
- end
-
- def _implicit_render
- render
- end
-
- def method_for_action(action_name)
- super || begin
- if view_paths.find_by_parts?(action_name.to_s, {:formats => formats, :locales => [I18n.locale]}, controller_path)
- "_implicit_render"
- end
- end
- end
end
end \ No newline at end of file