Last active
May 10, 2016 16:40
-
-
Save kirs/facbe6128ec4a2ff606101c829a99688 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/setup' | |
require 'active_support/all' | |
require 'rack' | |
require 'rack/test' | |
require 'action_controller/metal/strong_parameters' | |
require 'stronger_parameters' | |
require 'byebug' | |
input = { | |
order: { | |
customers_attributes: { | |
"0" => { | |
'first_name' => 'Steve', | |
'last_name' => 'Lastnameson', | |
'email' => '[email protected]', | |
}, | |
"1" => { | |
'first_name' => 'Steve', | |
'last_name' => 'Lastnameson', | |
'email' => '[email protected]', | |
} | |
} | |
} | |
} | |
params = ActionController::Parameters.new(input) | |
params.require_hash(:order).permit_types( | |
customers_attributes: Array | |
) | |
# raises UnpermittedParameterType because customer_attributes is technically a Hash, not an Array |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment