diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2008-10-05 13:55:28 +0100 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2008-10-05 14:01:00 +0100 |
commit | 4f53db0096be4b167628a136044b0d1262215277 (patch) | |
tree | 00277aeb7d0e949aec56b4bf3b2846dd73104a59 /actionpack/lib | |
parent | 259a7a844b53b7d508145cc61fed9e11581e5409 (diff) | |
download | rails-4f53db0096be4b167628a136044b0d1262215277.tar.gz rails-4f53db0096be4b167628a136044b0d1262215277.tar.bz2 rails-4f53db0096be4b167628a136044b0d1262215277.zip |
Move controller ivar copying to a separate method
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/base.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index 77015ad06b..8df10c40cc 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -290,21 +290,23 @@ module ActionView #:nodoc: private attr_accessor :_first_render, :_last_render - # Evaluate the local assigns and pushes them to the view. + # Evaluates the local assigns and controller ivars, pushes them to the view. def _evaluate_assigns_and_ivars #:nodoc: unless @assigns_added @assigns.each { |key, value| instance_variable_set("@#{key}", value) } - - if @controller - variables = @controller.instance_variable_names - variables -= @controller.protected_instance_variables if @controller.respond_to?(:protected_instance_variables) - variables.each { |name| instance_variable_set(name, @controller.instance_variable_get(name)) } - end - + _copy_ivars_from_controller @assigns_added = true end end + def _copy_ivars_from_controller #:nodoc: + if @controller + variables = @controller.instance_variable_names + variables -= @controller.protected_instance_variables if @controller.respond_to?(:protected_instance_variables) + variables.each { |name| instance_variable_set(name, @controller.instance_variable_get(name)) } + end + end + def _set_controller_content_type(content_type) #:nodoc: if controller.respond_to?(:response) controller.response.content_type ||= content_type |