-
Notifications
You must be signed in to change notification settings - Fork 403
Common Gotchas
Geremia Taglialatela edited this page Jan 31, 2021
·
8 revisions
It may sound obvious, but form_for validate: true
is different from form_for validate: :true(note the symbol instead of
true`).
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
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