Identify GET and POST parameters in Ruby on Rails

前端 未结 11 777
我在风中等你
我在风中等你 2020-12-08 14:16

What is the simplest way to identify and separate GET and POST parameters from a controller in Ruby on Rails, which will be equivalent to $_GET and $_POST variables in PHP?<

11条回答
  •  臣服心动
    2020-12-08 14:52

    request.get? will return boolean true if it is GET method,

    request.post? will return boolean true if it is POST method,

提交回复
热议问题