add class in form_for rails code example Example: class on form_for = form_for @user, html: {class: 'x', data: { bar: 'baz' } } do |f|