aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-08-27 23:33:49 -0300
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-08-30 01:01:01 -0300
commit01bfd15a269fd6f4701d3d73c892362a93e4f65f (patch)
tree190666b2ead47bc0ae4231cf45c15c581b109f7a
parent1297d223b4f9da672e14b47fc106a28596fb87a8 (diff)
downloadrails-01bfd15a269fd6f4701d3d73c892362a93e4f65f.tar.gz
rails-01bfd15a269fd6f4701d3d73c892362a93e4f65f.tar.bz2
rails-01bfd15a269fd6f4701d3d73c892362a93e4f65f.zip
Stop messing up with instance variables, use protected as it was meant for
-rw-r--r--actionpack/lib/action_controller/metal/strong_parameters.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb
index b279ef81a9..ae600b1ebe 100644
--- a/actionpack/lib/action_controller/metal/strong_parameters.rb
+++ b/actionpack/lib/action_controller/metal/strong_parameters.rb
@@ -298,7 +298,7 @@ module ActionController
# params.slice(:d) # => {}
def slice(*keys)
self.class.new(super).tap do |new_instance|
- new_instance.instance_variable_set :@permitted, @permitted
+ new_instance.permitted = @permitted
end
end
@@ -312,10 +312,15 @@ module ActionController
# copy_params.permitted? # => true
def dup
super.tap do |duplicate|
- duplicate.instance_variable_set :@permitted, @permitted
+ duplicate.permitted = @permitted
end
end
+ protected
+ def permitted=(new_permitted)
+ @permitted = new_permitted
+ end
+
private
def convert_hashes_to_parameters(key, value)
if value.is_a?(Parameters) || !value.is_a?(Hash)