Class: Rapidfire::Questions::Date
- Inherits:
-
Rapidfire::Question
- Object
- ActiveRecord::Base
- Rapidfire::Question
- Rapidfire::Questions::Date
- Defined in:
- app/models/rapidfire/questions/date.rb
Instance Method Summary collapse
Methods inherited from Rapidfire::Question
Instance Method Details
#validate_answer(answer) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'app/models/rapidfire/questions/date.rb', line 4 def validate_answer(answer) super(answer) if rules[:presence] == "1" || answer.answer_text.present? begin ::Date.parse(answer.answer_text.to_s) rescue ArgumentError => e answer.errors.add(:answer_text, :invalid) end end end |