aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/abstract_controller
diff options
context:
space:
mode:
authorŁukasz Strzałkowski <lukasz.strzalkowski@gmail.com>2013-09-02 23:05:42 +0200
committerŁukasz Strzałkowski <lukasz.strzalkowski@gmail.com>2013-09-02 23:18:02 +0200
commit40fcb9e82220fe9a7a3b0b3aeee61f92f00942c2 (patch)
treee71a52d4352c0913b95ed2503b5c7e61ffa51d4e /actionpack/lib/abstract_controller
parent90ea6f928ce0f0efef3109045a74469c4a3e3f99 (diff)
downloadrails-40fcb9e82220fe9a7a3b0b3aeee61f92f00942c2.tar.gz
rails-40fcb9e82220fe9a7a3b0b3aeee61f92f00942c2.tar.bz2
rails-40fcb9e82220fe9a7a3b0b3aeee61f92f00942c2.zip
Revert "Port all remaining self.protected_instance_variables to class methods"
This reverts commit 7de994fa215e9f4c2856d85034bc4dd7b65d0c01.
Diffstat (limited to 'actionpack/lib/abstract_controller')
-rw-r--r--actionpack/lib/abstract_controller/base.rb5
-rw-r--r--actionpack/lib/abstract_controller/rendering.rb16
2 files changed, 11 insertions, 10 deletions
diff --git a/actionpack/lib/abstract_controller/base.rb b/actionpack/lib/abstract_controller/base.rb
index a84ed17bd4..af5de815bb 100644
--- a/actionpack/lib/abstract_controller/base.rb
+++ b/actionpack/lib/abstract_controller/base.rb
@@ -114,11 +114,6 @@ module AbstractController
end
end
- # Define some internal variables that should not be propagated to the view.
- def self.default_protected_instance_vars
- []
- end
-
abstract!
# Calls the action going through the entire action dispatch stack.
diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb
index 41f19fba78..5a5c47eb3b 100644
--- a/actionpack/lib/abstract_controller/rendering.rb
+++ b/actionpack/lib/abstract_controller/rendering.rb
@@ -13,8 +13,13 @@ module AbstractController
module Rendering
extend ActiveSupport::Concern
- def self.default_protected_instance_vars
- super.concat [:@_action_name, :@_response_body, :@_formats, :@_prefixes, :@_config]
+ included do
+ class_attribute :protected_instance_variables
+ self.protected_instance_variables = []
+ end
+
+ def default_protected_instance_vars
+ [:@_action_name, :@_response_body, :@_formats, :@_prefixes, :@_config]
end
# Raw rendering of a template to a string.
@@ -52,9 +57,10 @@ module AbstractController
# :api: public
def view_assigns
hash = {}
- (instance_variables - self.class.default_protected_instance_vars).each do |name|
- hash[name[1..-1]] = instance_variable_get(name)
- end
+ variables = instance_variables
+ variables -= protected_instance_variables
+ variables -= default_protected_instance_vars
+ variables.each { |name| hash[name[1..-1]] = instance_variable_get(name) }
hash
end