Hidden Features of Ruby on Rails [closed]

To avoid duplicate form submissions, Rails has a nice option for submit tags:

submit_tag "Submit", :disable_with => "Saving..."

This adds behavior to the submit button to disable it once clicked, and to display “Saving…” instead of “Submit”.

Rails 4+

 DEPRECATION WARNING: :disable_with option is deprecated and 
 will be removed from Rails 4.1. Use 'data: { disable_with: 'Text' }' instead.

Thus the above becomes:

submit_tag 'Submit', data: { disable_with: 'Text' }

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)