Skip to content
Geremia Taglialatela edited this page Jan 31, 2021 · 8 revisions

validate: true vs. validate: :true

It may sound obvious, but form_for validate: true is different from form_for validate: :true(note the symbol instead oftrue`).

This is because when you pass a symbol to :validate it will assign the script to content_for so you can render the script tag elsewhere. (See https://github.com/bcardarella/client_side_validations/issues/98)

If you accidentally use :true instead of true your client side validations will not work, with the following error displayed in your browser's js error console.

settings is undefined

Use :symbol attribute names

When using f.text_field "name", despite field properly rendered, validations aren't loaded for this field. You have to use f.text_field :name