rails/strong_parameters — pull request #117 by d-Pixie (2013-03-11 11:22:53+00:00)
Title: Allow multiple keys in call to require

The current version of require takes only one key and returns the value for that key (or raises if it's not present). I added code to support calls like this:
```ruby
params = ActionController::Parameters.new(:username => 'user', :password => '<3<3<3<3', :version => 1)
params.require(:username, :password)
# => {"username"=>"user", "password"=>"<3<3<3<3", "version"=>1}
```
It still throws if the required parameters are missing, including all the missing keys:
```ruby
params = ActionController::Parameters.new(:version => 1)
params.require(:username, :password)
# => "Required parameter(s) missing: username, password"
```
Since it's not reasonable to return the keys values in this case the method simply returns self instead. This allows for other methods to be chained as expected.

Basically it allows you to do:
```ruby
params.require(:user, :post).permit(:user => [:name], :post => [:content])
```
instead of:
```ruby
params.require(:user).permit(:name)
params.require(:post).permit(:content)
```
And for the cases where you don't have the normal, nested hashes (such as in my case of an API accepting a non nested list of parameters) you won't have to do one call to permit for every required parameter in the API call.

I don't know if this is interesting for inclusion, it's not really an edge case, but not the most common case either, nor if the approach presented here is the best/a good enough one ... So comments on the code are most welcome.