Turn autocomplete off with rails form_tag

In latest version of chrome autocomplete: 'off' does not work. Instead use autocomplete: 'disabled'


As of Rails 4+

Disable autocomplete for an entire form with form_tag:

= form_tag admin_sessions_path, html: { autocomplete: "off" } do

Disable autocomplete for an entire form with form_for:

= form_for @user, html: { autocomplete: "off" } do |f|

Disable autocomplete for a single form element:

= f.text_field :foo, autocomplete: 'off'

Hope this helps!


the autocomplete attribute should be assigned to the html key like so:

html: {autocomplete: 'off'}