Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是rails的初学者,我想知道这两者之间的区别是什么:
params["user_id"]
和
params[:user_id]
在第一次调用中,您将字符串传递给[]方法,在第二次调用中,您传递符号。由于params返回HashWithIndifferentAccess实例,因此返回的对象没有区别。
[]
params
HashWithIndifferentAccess
更多关于HashWithIndifferentAccess课堂的信息。