I have a rails form calling upon the create function in my controller, and I've noticed if i press the submit button multiple times while the page loads, I am able to submit the form multiple times. Is there a way to prevent this from happening? My button is:
<%= 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 %>
And my controller is:
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`
Aucun commentaire:
Enregistrer un commentaire