Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Stop messing up with instance variables, use protected as it was mean…

…t for
  • Loading branch information...
commit 01bfd15a269fd6f4701d3d73c892362a93e4f65f 1 parent 1297d22
@carlosantoniodasilva carlosantoniodasilva authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 actionpack/lib/action_controller/metal/strong_parameters.rb
View
9 actionpack/lib/action_controller/metal/strong_parameters.rb
@@ -298,7 +298,7 @@ def fetch(key, *args)
# 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 @@ def slice(*keys)
# 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
@spastorino Owner

attr_writer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
private
def convert_hashes_to_parameters(key, value)
if value.is_a?(Parameters) || !value.is_a?(Hash)
Please sign in to comment.
Something went wrong with that request. Please try again.