Skip to content

Order of keys when using strong parameters #12149

@teamon

Description

@teamon

Looks like order of keys in hash passed to permit(...) method does matter:

ActionController::Parameters.new(:a => 1, :b => [1,2,3], :c => nil).permit(:a, :b => [], :c => [])
=> {"a"=>1, "b"=>[1, 2, 3]}

ActionController::Parameters.new(:a => 1, :b => [1,2,3], :c => nil).permit(:a, :c => [], :b => [])
=> {"a"=>1}

ActionController::Parameters.new(:a => 1, :b => [1,2,3]).permit(:a, :c => [], :b => [])
=> {"a"=>1, "b"=>[1, 2, 3]}

what is going on here?

Rails: 4.0.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions