How to not use Rails action parameter in controller

前端 未结 2 874
清歌不尽
清歌不尽 2020-12-31 23:37

I am implementing a third party API for Shipworks in a Rails server and the Shipworks client app is posting an action param with Shipworks specific semantics.

2条回答
  •  星月不相逢
    2021-01-01 00:10

    I fell into this trap today and came with this solution in controller method. It's Rails 4.1:

    if request.method == "POST"
      action = request.request_parameters['action']
    else
      action = request.query_parameters['action']
    end
    

提交回复
热议问题