0
我有一个Rails窗体调用我的控制器中的创建函数,并且我注意到如果在页面加载时多次按下提交按钮,我可以多次提交表单。有没有办法来防止这种情况发生?我的按钮是:Rails创建表单提交多次
<%= button_to edit_production_path(id: current_user.default_working_production_id), class: "btn btn-default navbar-btn", :method => :get do %><span class="glyphicon glyphicon-film"></span> Production Settings<% end %>
我的控制器:
def create
@production = Production.new(production_params)
@production.user = current_user
@production.user_name = current_user.name
if @production.save
redirect_to productions_path
else
render 'new'
end
end`