HashWithIndifferentAccess

The params method returns the parameters passed to the action, such as those from
the form or query parameters from a URL , as a HashWithIndifferentAccess object.
This is different from a normal Hash object, because you can reference a String key
by using a matching Symbol , and vice versa.

一般的hash是不能把string key和symbol key等同的。HashWithIndifferentAccess可以。

2.3.0 :003 > hash = {name:"zll",age:35} => {:name=>"zll", :age=>35}

2.3.0 :004 > hash["name"] => nil

2.3.0 :005 > hash[:name] => "zll" 

原文地址:https://www.cnblogs.com/highsky/p/6576599.html