Rails: flash 消息显示在 url 作为参数

Rails: flash message shows in the url as param

您好,我所有的即显信息都以正常方式工作,但是我的其中一个控制器中的某项操作使即显信息不起作用。

这是观点:

<%= form_tag update_status_order_path(update_status), method: :put do |f| %>
    <%= select(:order, :status, [['Active', 1], ['Inactive', 0]]) %>
    <%= submit_tag "Update" %>
<% end %>

这是控制器动作

def update_status
        if @order.update_order_status! params[:order][:status] 
            redirect_to show_orders_ofert_path @order.ofert, success: "Updated!."
        else
            redirect_to show_orders_ofert_path @order.ofert, error: "Error."
        end
    end

当我发送表单时,操作被正确执行,但是 flash 消息没有显示在布局中,而是作为参数显示在 url 中,点击更新按钮后它会重新加载和像这样显示 url:

http://localhost:3000/oferts/48/show_orders?success=Updated!

我试过将 put 更改为 patch 但没有成功,甚至更改 action 以使用 respons_to block 但它没有成功,知道吗?

这个问题只发生在那个特定的操作上,因为我有其他操作时,闪现信息可以正常播放。

谢谢

成功和错误键被用作 show_orders_ofert_path 的参数,因为没有括号。在路径助手参数周围添加括号:

redirect_to show_orders_ofert_path(@order.ofert), success: "Updated!."