zll11111

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

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" 

posted on 2017-03-18 22:53  zll11111  阅读(120)  评论(0编辑  收藏  举报