سؤال

I'm a beginner in rails, I want to know what is the diiference between these two:

params["user_id"]

and

params[:user_id]
هل كانت مفيدة؟

المحلول

In first call, you pass string to [] method, in secod, you pass symbol. Since params returns HashWithIndifferentAccess instance, there's no difference in returned object.

More about HashWithIndifferentAccess class here.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top