This project is archived and is in readonly mode.
Validations of acceptance not working
-
Alexey Poimtsev
- Tag changed from validates_acceptance_of rails3, validations to validations
-
Raony vieira
I've go a bit similar problem, my is not validating my collection_select.
Does someone have a clue about that?
cheers -
Neeraj Singh
- Importance changed from to Low
by default nil is allowed. You need to do
validates :terms, :acceptance => true, :allow_nil => falseI do agree that :allow_nil should be 'false' be default. That would make more sense. I will talk to rails core team member and if agree will change the default value.
-
José Valim
- State changed from new to invalid
:allow_nil should be true. Because it allows you to create users through the console/tests without having to specify :terms => true, so it is a convenience.
This won't be a problem in your views, because once you do: f.checkbox :terms, it will never be nil because it would already default to false.