aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/metal/strong_parameters.rb
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2015-08-28 16:23:31 +0200
committerXavier Noria <fxn@hashref.com>2015-08-28 17:15:20 +0200
commitcbe7899f9d5fece4749f75828fd120d67056f356 (patch)
tree6601a582e3945928194bf3ac5b8f40c39c8d7ec9 /actionpack/lib/action_controller/metal/strong_parameters.rb
parent35df925b475f2f9fc593c4a1caf5009e5c970b0d (diff)
downloadrails-cbe7899f9d5fece4749f75828fd120d67056f356.tar.gz
rails-cbe7899f9d5fece4749f75828fd120d67056f356.tar.bz2
rails-cbe7899f9d5fece4749f75828fd120d67056f356.zip
revises 877e42e
* A string in the example lacked quotes. * The tests asserted stuff about :last_name, whereas test params do not have that key. * But, the first one passed, why? After hitting my head against the wall and doing some obscure rituals realized the new #require had an important typo, wanted to iterate over the array argument (key), but it ran over its own hash keys (method #keys). * Modified the test to prevent the same typo to happen again. * The second test assigned to an unused variable safe_params that has been therefore removed. * Grammar of the second test description. * Since I was on it, reworded both test descriptions.
Diffstat (limited to 'actionpack/lib/action_controller/metal/strong_parameters.rb')
-rw-r--r--actionpack/lib/action_controller/metal/strong_parameters.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb
index 02599a4654..da507ca294 100644
--- a/actionpack/lib/action_controller/metal/strong_parameters.rb
+++ b/actionpack/lib/action_controller/metal/strong_parameters.rb
@@ -256,11 +256,11 @@ module ActionController
# ActionController::Parameters.new(first_name: 'Gaurish', title: nil).require([:first_name, :title])
# # => ActionController::ParameterMissing: param is missing or the value is empty: title
#
- # params = ActionController::Parameters.new(first_name: 'Gaurish', title: Mjallo)
+ # params = ActionController::Parameters.new(first_name: 'Gaurish', title: 'Mjallo')
# first_name, title = params.require([:first_name, :title])
#
def require(key)
- return keys.map { |k| require(k) } if key.is_a?(Array)
+ return key.map { |k| require(k) } if key.is_a?(Array)
value = self[key]
if value.present? || value == false
value