aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r--actionpack/lib/action_controller/abstract/base.rb2
-rw-r--r--actionpack/lib/action_controller/abstract/callbacks.rb2
-rw-r--r--actionpack/lib/action_controller/abstract/helpers.rb6
-rw-r--r--actionpack/lib/action_controller/abstract/layouts.rb5
-rw-r--r--actionpack/lib/action_controller/abstract/logger.rb1
-rw-r--r--actionpack/lib/action_controller/abstract/renderer.rb19
-rw-r--r--actionpack/lib/action_controller/base/compatibility.rb4
-rw-r--r--actionpack/lib/action_controller/base/helpers.rb2
-rw-r--r--actionpack/lib/action_controller/base/http.rb1
-rw-r--r--actionpack/lib/action_controller/routing/generation/polymorphic_routes.rb1
-rw-r--r--actionpack/lib/action_controller/testing/process.rb1
11 files changed, 17 insertions, 27 deletions
diff --git a/actionpack/lib/action_controller/abstract/base.rb b/actionpack/lib/action_controller/abstract/base.rb
index a19a236ef7..ca00e66349 100644
--- a/actionpack/lib/action_controller/abstract/base.rb
+++ b/actionpack/lib/action_controller/abstract/base.rb
@@ -1,5 +1,3 @@
-require 'active_support/core_ext/module/attr_internal'
-
module AbstractController
class Base
diff --git a/actionpack/lib/action_controller/abstract/callbacks.rb b/actionpack/lib/action_controller/abstract/callbacks.rb
index 0d5161c80e..ea4b59466e 100644
--- a/actionpack/lib/action_controller/abstract/callbacks.rb
+++ b/actionpack/lib/action_controller/abstract/callbacks.rb
@@ -1,3 +1,5 @@
+require "active_support/new_callbacks"
+
module AbstractController
module Callbacks
extend ActiveSupport::Concern
diff --git a/actionpack/lib/action_controller/abstract/helpers.rb b/actionpack/lib/action_controller/abstract/helpers.rb
index 6b73f887c1..5efa37fde3 100644
--- a/actionpack/lib/action_controller/abstract/helpers.rb
+++ b/actionpack/lib/action_controller/abstract/helpers.rb
@@ -8,12 +8,6 @@ module AbstractController
extlib_inheritable_accessor(:_helpers) { Module.new }
end
- # Override AbstractController::Renderer's _action_view to include the
- # helper module for this class into its helpers module.
- def _action_view
- @_action_view ||= super.tap { |av| av.helpers.include(_helpers) }
- end
-
module ClassMethods
# When a class is inherited, wrap its helper module in a new module.
# This ensures that the parent class's module can be changed
diff --git a/actionpack/lib/action_controller/abstract/layouts.rb b/actionpack/lib/action_controller/abstract/layouts.rb
index 2ac4e6068a..f021dd8b62 100644
--- a/actionpack/lib/action_controller/abstract/layouts.rb
+++ b/actionpack/lib/action_controller/abstract/layouts.rb
@@ -6,6 +6,7 @@ module AbstractController
included do
extlib_inheritable_accessor(:_layout_conditions) { Hash.new }
+ _write_layout_method
end
module ClassMethods
@@ -99,7 +100,7 @@ module AbstractController
# the lookup to. By default, layout lookup is limited to the
# formats specified for the current request.
def _layout_for_name(name, details = {:formats => formats})
- name && _find_by_parts(name, details)
+ name && _find_layout(name, details)
end
# Take in the name and details and find a Template.
@@ -111,7 +112,7 @@ module AbstractController
#
# ==== Returns
# Template:: A template object matching the name and details
- def _find_by_parts(name, details)
+ def _find_layout(name, details)
# TODO: Make prefix actually part of details in ViewPath#find_by_parts
prefix = details.key?(:prefix) ? details.delete(:prefix) : "layouts"
view_paths.find_by_parts(name, details, prefix)
diff --git a/actionpack/lib/action_controller/abstract/logger.rb b/actionpack/lib/action_controller/abstract/logger.rb
index b960e152e3..fd33bd2ddd 100644
--- a/actionpack/lib/action_controller/abstract/logger.rb
+++ b/actionpack/lib/action_controller/abstract/logger.rb
@@ -1,4 +1,3 @@
-require 'active_support/core_ext/class/attribute_accessors'
require 'active_support/core_ext/logger'
module AbstractController
diff --git a/actionpack/lib/action_controller/abstract/renderer.rb b/actionpack/lib/action_controller/abstract/renderer.rb
index 611d3a16ce..41b7d47458 100644
--- a/actionpack/lib/action_controller/abstract/renderer.rb
+++ b/actionpack/lib/action_controller/abstract/renderer.rb
@@ -17,25 +17,22 @@ module AbstractController
# An instance of a view class. The default view class is ActionView::Base
#
# The view class must have the following methods:
- # initialize[paths, assigns_for_first_render, controller]
- # paths<Array[ViewPath]>:: A list of resolvers to look for templates in
- # controller<AbstractController::Base> A controller
- # _render_partial_from_controller[options]
+ # View.for_controller[controller] Create a new ActionView instance for a
+ # controller
+ # View#_render_partial_from_controller[options]
+ # - responsible for setting options[:_template]
+ # - Returns String with the rendered partial
# options<Hash>:: see _render_partial in ActionView::Base
- # _render_template_from_controller[template, layout, options, partial]
+ # View#_render_template_from_controller[template, layout, options, partial]
+ # - Returns String with the rendered template
# template<ActionView::Template>:: The template to render
# layout<ActionView::Template>:: The layout to render around the template
# options<Hash>:: See _render_template_with_layout in ActionView::Base
# partial<Boolean>:: Whether or not the template to render is a partial
- # _partial:: If a partial, rather than a template, was rendered, return
- # the partial.
- # helpers:: A module containing the helpers to be used in the view. This
- # module should respond_to include.
- # controller:: The controller that initialized the ActionView
#
# Override this method in a to change the default behavior.
def _action_view
- @_action_view ||= ActionView::Base.new(self.class.view_paths, {}, self)
+ @_action_view ||= ActionView::Base.for_controller(self)
end
# Mostly abstracts the fact that calling render twice is a DoubleRenderError.
diff --git a/actionpack/lib/action_controller/base/compatibility.rb b/actionpack/lib/action_controller/base/compatibility.rb
index cd4b72b1c6..13813ffd17 100644
--- a/actionpack/lib/action_controller/base/compatibility.rb
+++ b/actionpack/lib/action_controller/base/compatibility.rb
@@ -114,7 +114,7 @@ module ActionController
super || (respond_to?(:method_missing) && "_handle_method_missing")
end
- def _find_by_parts(name, details)
+ def _find_layout(name, details)
details[:prefix] = nil if name =~ /\blayouts/
super
end
@@ -123,7 +123,7 @@ module ActionController
def _default_layout(details, require_layout = false)
super
rescue ActionView::MissingTemplate
- _find_by_parts(_layout({}), {})
+ _find_layout(_layout({}), {})
nil
end
diff --git a/actionpack/lib/action_controller/base/helpers.rb b/actionpack/lib/action_controller/base/helpers.rb
index 2fa5ea6519..7c52779064 100644
--- a/actionpack/lib/action_controller/base/helpers.rb
+++ b/actionpack/lib/action_controller/base/helpers.rb
@@ -1,5 +1,3 @@
-require 'active_support/core_ext/load_error'
-require 'active_support/core_ext/name_error'
require 'active_support/dependencies'
module ActionController
diff --git a/actionpack/lib/action_controller/base/http.rb b/actionpack/lib/action_controller/base/http.rb
index ec78bc15a8..3efd1b656f 100644
--- a/actionpack/lib/action_controller/base/http.rb
+++ b/actionpack/lib/action_controller/base/http.rb
@@ -1,5 +1,4 @@
require 'action_controller/abstract'
-require 'active_support/core_ext/module/delegation'
module ActionController
# ActionController::Http provides a way to get a valid Rack application from a controller.
diff --git a/actionpack/lib/action_controller/routing/generation/polymorphic_routes.rb b/actionpack/lib/action_controller/routing/generation/polymorphic_routes.rb
index c6f7de17bd..159d869a54 100644
--- a/actionpack/lib/action_controller/routing/generation/polymorphic_routes.rb
+++ b/actionpack/lib/action_controller/routing/generation/polymorphic_routes.rb
@@ -77,6 +77,7 @@ module ActionController
end
record = extract_record(record_or_hash_or_array)
+ record = record.to_model if record.respond_to?(:to_model)
namespace = extract_namespace(record_or_hash_or_array)
args = case record_or_hash_or_array
diff --git a/actionpack/lib/action_controller/testing/process.rb b/actionpack/lib/action_controller/testing/process.rb
index 7634290ea1..e7c64d0942 100644
--- a/actionpack/lib/action_controller/testing/process.rb
+++ b/actionpack/lib/action_controller/testing/process.rb
@@ -1,3 +1,4 @@
+require 'action_dispatch'
require 'rack/session/abstract/id'
require 'active_support/core_ext/object/conversions'