Skip to content

Instantly share code, notes, and snippets.

@kirs
Last active May 10, 2016 16:40
Show Gist options
  • Save kirs/facbe6128ec4a2ff606101c829a99688 to your computer and use it in GitHub Desktop.
Save kirs/facbe6128ec4a2ff606101c829a99688 to your computer and use it in GitHub Desktop.
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