开发者

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

开发者 https://www.devze.com 2023-03-08 15:25 出处:网络
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:

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 req开发者_高级运维uest 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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消