'Presence true using validate_timeliness gem
Is there any built in method required using validate_timeliness? I want my birthday field to be required, when I separated the presence(like this)
Model
# validates :birthday,
# :presence => true,
# :on => :create
it will show both errors(first error will be birthday can't be blank and the other one is birthday is not a valid date).
Model
validates_date :birthday, :if :birthday,
:before => lambda { 18.years.ago },
:before_message => "must be at least 18 years old"
:end
Question: How can I check if my birthday is not a nil?
Note: I also tried this
Model
validates_date :birthday, :if birthday.present?, # here's the line giving an error
:before => lambda { 18.years.ago },
:before_message => "must be at least 18 years old",
:end
but it gives me an error expecting keyword_end
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
