Commit Graph

10 Commits

Author SHA1 Message Date
Gaurish Sharma
877e42e232 [Feature] params.require requires array of params
This PR adds ability to accept arrays which allows you to require multiple values in one method. so instead of this:

```ruby
params.require(:person).require(:first_name)
params.require(:person).require(:last_name)
```

Here it will be one line for each params, so say if I require 10params, it will be 10lines of repeated code which is not dry. So I have added new method which does this in one line:

```ruby
params.require(:person).require([:first_name, :last_name])
```

Comments welcome
2015-08-28 18:02:13 +05:30
Kir Shatrov
baf14ae513 Switch to kwargs in ActionController::TestCase and ActionDispatch::Integration
Non-kwargs requests are deprecated now.
Guides are updated as well.

`post url, nil, nil, { a: 'b' }` doesn't make sense.
`post url, params: { y: x }, session: { a: 'b' }` would be an explicit way to do the same
2015-01-29 14:44:46 +02:00
Matthew Draper
497def80b5 Merge pull request #15692 from sromano/falseClass
ActionController::Parameters#require now accepts FalseClass values
2014-06-14 06:14:19 +09:30
Sergio Romano
540d153531 ActionController::Parameters#require now accepts FalseClass values
Fixes #15685.
2014-06-13 14:42:38 -03:00
Arthur Neves
aae53d2175 unify param.require tests 2014-01-23 22:28:24 -05:00
Guillermo Iguaran
f886fe2d8c Revert "Merge pull request #9660 from sebasoga/change_strong_parameters_require_behaviour"
This reverts commit c2b5a8e61ba0f35015e6ac949a5c8fce2042a1f2, reversing
changes made to 1918b12c0429caec2a6134ac5e5b42ade103fe90.

See: https://github.com/rails/rails/pull/9660#issuecomment-27627493
2013-11-02 14:30:03 -05:00
Sebastian Sogamoso
b3f894c528 Change ActionController::Parameters#require behavior when value is empty
When the value for the required key is empty an ActionController::ParameterMissing is raised which gets caught by ActionController::Base and turned into a 400 Bad Request reply with a message in the body saying the key is missing, which is misleading.

With these changes, ActionController::EmptyParameter will be raised which ActionController::Base will catch and turn into a 400 Bad Request reply with a message in the body saying the key value is empty.
2013-03-11 09:28:22 -05:00
Carlos Antonio da Silva
e5f5863e86 Remove warnings: "(...) interpreted as grouped expression" 2013-01-16 09:41:08 -02:00
Brian Alexander
8e221127ab strong parameters exception handling 2013-01-15 17:45:34 -07:00
Guillermo Iguaran
885005461b Integrate ActionController::Parameters from StrongParameters gem 2012-09-16 23:58:19 -05:00