我有一个表单需要提交给控制器中的“更新”操作。 “show”操作被调用,而“update”操作从不运行。Rails显示操作被调用而不是更新操作
我的路线:
evaluations GET /evaluations(.:format) evaluations#index POST /evaluations(.:format) evaluations#create new_evaluation GET /evaluations/new(.:format) evaluations#new edit_evaluation GET /evaluations/:id/edit(.:format) evaluations#edit evaluation GET /evaluations/:id(.:format) evaluations#show PATCH /evaluations/:id(.:format) evaluations#update PUT /evaluations/:id(.:format) evaluations#update DELETE /evaluations/:id(.:format) evaluations#destroy
的形式创建:
action: "<%= evaluation_path %>",
method: "patch" //I have tried both "post" and "put" as well
我的控制器有一个有效的 “更新” 行动也是如此。
表单是从传递给React组件的Javascript对象呈现的。 – cmwall
请向我们展示整个表单代码,至少form_for或form_tag。 – Leito
没有form_for标签。表单是通过将JavaScript对象传递给React组件来创建的,React组件然后设置动作和方法。 – cmwall