aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/abstract_controller/rendering.rb
diff options
context:
space:
mode:
authorCarlhuda <carlhuda@engineyard.com>2010-03-18 15:52:43 -0700
committerCarlhuda <carlhuda@engineyard.com>2010-03-18 15:52:43 -0700
commit71c9337f45f9c5461cbc6ddf6cab764ad0f82c3b (patch)
tree4e4a89ceca056d7ee4fcf329ecb56bbc0547d553 /actionpack/lib/abstract_controller/rendering.rb
parent523d0f3700f5bb68cdd3d549eaad63d8a88c2aef (diff)
downloadrails-71c9337f45f9c5461cbc6ddf6cab764ad0f82c3b.tar.gz
rails-71c9337f45f9c5461cbc6ddf6cab764ad0f82c3b.tar.bz2
rails-71c9337f45f9c5461cbc6ddf6cab764ad0f82c3b.zip
All tests pass without memoizing view_context
Diffstat (limited to 'actionpack/lib/abstract_controller/rendering.rb')
-rw-r--r--actionpack/lib/abstract_controller/rendering.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb
index 16664098e5..eec7e520fa 100644
--- a/actionpack/lib/abstract_controller/rendering.rb
+++ b/actionpack/lib/abstract_controller/rendering.rb
@@ -32,7 +32,6 @@ module AbstractController
module Rendering
extend ActiveSupport::Concern
- include AbstractController::Assigns
include AbstractController::ViewPaths
# Overwrite process to setup I18n proxy.
@@ -53,7 +52,8 @@ module AbstractController
#
# Override this method in a module to change the default behavior.
def view_context
- @_view_context ||= ActionView::Base.for_controller(self)
+ klass = ActionView::Base.for_controller(self)
+ klass.new(lookup_context, view_assigns, self)
end
# Normalize arguments, options and then delegates render_to_body and
@@ -82,7 +82,6 @@ module AbstractController
# Find and renders a template based on the options given.
# :api: private
def _render_template(options) #:nodoc:
- _evaluate_assigns(view_context)
view_context.render(options)
end
@@ -105,6 +104,17 @@ module AbstractController
private
+ # This method should return a hash with assigns.
+ # You can overwrite this configuration per controller.
+ # :api: public
+ def view_assigns
+ hash = {}
+ variables = instance_variable_names
+ variables -= protected_instance_variables if respond_to?(:protected_instance_variables)
+ variables.each { |name| hash[name.to_s[1..-1]] = instance_variable_get(name) }
+ hash
+ end
+
# Normalize options by converting render "foo" to render :action => "foo" and
# render "foo/bar" to render :file => "foo/bar".
def _normalize_args(action=nil, options={})