VXCSL
VXCSL

Reputation: 37

Conversion in rails params for a hash

When sending params to a rails controller like from a test or a view

 { "a[b]" => true }   

I receive it as

 {"a" => {"b" => true}}  

I would like to know how this happens

Upvotes: 0

Views: 53

Answers (1)

Sandeep Garg
Sandeep Garg

Reputation: 1276

This happened because rails middleware convert this type of parameter into hash so that it is more easy to access and use. You can have more in depth info in Rails guide.

Upvotes: 2

Related Questions