I have a submit button at the end of the form.
I have added the following condition to the submit button:
onClick=\"this.disabled=true; this.value=\'
I think easy way to disable button is :data => { disable_with: "Saving.." } This will submit a form and then make a button disable, Also it won't disable button if you have any validations like required = 'required'.
:data => { disable_with: "Saving.." }
required = 'required'.