문제

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