Ruby on Rails 3: How to retrieve POST and GET params separately?

与世无争的帅哥 提交于 2019-12-05 18:39:10

问题


I know you can get parameters using params, but the thing is that it merges all parameters whether they were sent via GET or POST:

If you send a request via GET, no problem, the parameters can only be squeezed in the URL.

But if you send a POST request that has a URL like /blabla?foo=bar&foo2=bar2, is there a way to tell the difference between the variables sent via the URL and the variables sent through the actual POST method?


回答1:


Yes, in your controller you can get the GET parameters using request.GET and the POST parameters with request.POST



来源:https://stackoverflow.com/questions/6151391/ruby-on-rails-3-how-to-retrieve-post-and-get-params-separately

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!