Skip to content

Instantly share code, notes, and snippets.

@teamon
Last active December 22, 2015 10:49
Show Gist options
  • Save teamon/6461821 to your computer and use it in GitHub Desktop.
Save teamon/6461821 to your computer and use it in GitHub Desktop.
[1] pry(main)> ActionController::Parameters.new(:a => 1, :b => [1,2,3], :c => nil).permit(:a, :b => [], :c => [])
=> {"a"=>1, "b"=>[1, 2, 3]}
[2] pry(main)> ActionController::Parameters.new(:a => 1, :b => [1,2,3], :c => nil).permit(:a, :c => [], :b => [])
=> {"a"=>1}
[3] pry(main)> ActionController::Parameters.new(:a => 1, :b => [1,2,3], :c => []).permit(:a, :b => [], :c => [])
=> {"a"=>1, "b"=>[1, 2, 3], "c"=>[]}
[4] pry(main)> ActionController::Parameters.new(:a => 1, :b => [1,2,3], :c => []).permit(:a, :c => [], :b => [])
=> {"a"=>1, "c"=>[], "b"=>[1, 2, 3]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment