Rails “action” params key conflict

2019-06-17 07:48发布

I am building a RESTful Rails service with various CRUD endpoints. On one of the Create endpoints, the data I am passing in includes:

...
action: "action_name"
...

The problem I am having is that params[:action] contains "create", not the actual value of the action parameter I'm passing in. This, I assume, is because params[:action] is being populated by Rails automatically.

Is there another way to access this key I am passing in? Am I doing something blatantly stupid?

1条回答
Ridiculous、
2楼-- · 2019-06-17 08:08

Its awkward to use this, but if ever its required, you can get the info using:

 request.POST
查看更多
登录 后发表回答