Your checks are performed using the validate method. However, the rails do not rely on the return value.
It depends on the presence of verification errors or not. Therefore, you should add errors when your model does not validate.
def something errors.add(:field, 'error message') end
Or, if the error is not related to the field:
def something errors.add(:base, 'error message') end
Then your model will not be saved, because there are errors.
Damien MATHIEU Oct 23 '09 at 7:47 2009-10-23 07:47
source share