In my rails app, I have a long Inventory form that I want to autosave. I used the code from this post. This creates the entry, but continues to create more entries since I have not changed the action to update. What do I add to the function so that Rails recognizes the next autosave as an update and not a create? Here is the javascript from the linked post:
setInterval(function(){
var form = $('#my-form-id');
var method = form.attr('method').toLowerCase(); // "get" or "post"
var action = form.attr('action'); // url to submit to
$[method](action, form.serialize(), function(data){
// Do something with the server response data
// Or at least let the user know it saved
});
},10000);