diff options
Diffstat (limited to 'actionpack/lib/action_view/base.rb')
-rw-r--r-- | actionpack/lib/action_view/base.rb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index c65048bfa0..ce629d332a 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -343,18 +343,20 @@ module ActionView #:nodoc: private # Evaluate the local assigns and pushes them to the view. - def evaluate_assigns + def evaluate_assigns_and_ivars unless @assigns_added - assign_variables_from_controller + @assigns.each { |key, value| instance_variable_set("@#{key}", value) } + + if @controller + variables = @controller.instance_variables + 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 + @assigns_added = true end end - # Assigns instance variables from the controller to the view. - def assign_variables_from_controller - @assigns.each { |key, value| instance_variable_set("@#{key}", value) } - end - def set_controller_content_type(content_type) if controller.respond_to?(:response) controller.response.content_type ||= content_type |