Rails 提交按钮仅在重新加载视图后有效

Rails submit button works only after reloading view

我有一个 rails 表单,在创建新模型时效果很好,但在编辑现有模型时却有问题。

这是行为:

下面是代码。

表格:

<%= form_for @client do |f| %>
    # Don't Think the problem is inside the form since it works after the reload.
    ...
    # Here is the button
    <button type="submit" value="submit" class="btn btn-success btn-lg pull-right cms-button">
        <i class="fa fa-check" aria-hidden="true"></i> Update Client
    </button>   
<% end %>

控制器:

def edit
  @client = Client.find( params[:id] )
end

def update
  @client = Client.find( params[:id] )
  if @client.update( client_params )
    flash[:notice] = "Client added succesfully"
    redirect_to( :action => 'show' )
  else
    render( 'edit)' )
  end
end

我必须在哪里进行更改才能使更新成功?

可能是HTML的问题,与rails本身无关,这个问题有同样的问题:Form Submit button only works after reload