Rails: Prevent duplicate inserts due to pressing back button and save again

前端 未结 8 1330
难免孤独
难免孤独 2020-12-09 12:13

Think about a simple Rails scaffold application with a \"new\" action containing a form to add records to a database with a \"save\" button. After the \"create\" action the

8条回答
  •  不思量自难忘°
    2020-12-09 12:53

    Add html: { autocomplete: "off" } in your form_for like this:

    <%= form_for @object, url: xxx_path, html: { autocomplete: "off" } do |f| %>
    

提交回复
热议问题