I'm almost cracking my head trying to do this birthdate validation. It
turns out that I can only accept users with at least 18 years old and
I'm trying to validate it writing this code on my user.rb fil at app/
class User < ActiveRecord::Base
validates_numericality_of :zip_code, :message => "must contain only
validates_numericality_of :phone, :message => "must contain only
validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-
validates_acceptance_of :policy_agreement, :message => "must be
accepted. You have to read and agree with the Aykall Policies before
validates_multiparameter_assignments :message => " is not a valid
age_limit = Date.new(Date.today.year, Date.today.month,
Date.today.day).change(:year => Date.today.year - 18)
validates_numericality_of :birth_date, :less_than =>
age_limit, :message => "is invalid. You have to be at least 18 years
old to sign in."
I'm getting the error message "undefined method `change' for #<Date:
4908815/2,0,2299161>" but, honestly, I don't know what else to try.
Can anyone help me?