diff options
author | Matthew Draper <matthew@trebex.net> | 2014-06-14 05:53:45 +0930 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2014-06-14 06:14:19 +0930 |
commit | 497def80b53db73712a6abf2c066e9bc4980ccd2 (patch) | |
tree | 0781c2304c05e1d5eef7661351f05ab03f3a26ad /actionpack/lib/action_controller/metal | |
parent | 49fee3d271e52a44a7bc7fcbbcb00792b613b7df (diff) | |
parent | 540d1535316d6ecbe755ee66dfcbc23dc0bde3a5 (diff) | |
download | rails-497def80b53db73712a6abf2c066e9bc4980ccd2.tar.gz rails-497def80b53db73712a6abf2c066e9bc4980ccd2.tar.bz2 rails-497def80b53db73712a6abf2c066e9bc4980ccd2.zip |
Merge pull request #15692 from sromano/falseClass
ActionController::Parameters#require now accepts FalseClass values
Diffstat (limited to 'actionpack/lib/action_controller/metal')
-rw-r--r-- | actionpack/lib/action_controller/metal/strong_parameters.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/metal/strong_parameters.rb b/actionpack/lib/action_controller/metal/strong_parameters.rb index c3c3e4c4f1..b70962cf44 100644 --- a/actionpack/lib/action_controller/metal/strong_parameters.rb +++ b/actionpack/lib/action_controller/metal/strong_parameters.rb @@ -184,7 +184,12 @@ module ActionController # ActionController::Parameters.new(person: {}).require(:person) # # => ActionController::ParameterMissing: param not found: person def require(key) - self[key].presence || raise(ParameterMissing.new(key)) + value = self[key] + if value.present? || value == false + value + else + raise ParameterMissing.new(key) + end end # Alias of #require. |