Class: Ankh::Validations::HumanValidator
- Inherits:
-
Object
- Object
- Ankh::Validations::HumanValidator
- Defined in:
- lib/ankh/validations/human_validator.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ HumanValidator
constructor
A new instance of HumanValidator.
- #validate(record) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ HumanValidator
Returns a new instance of HumanValidator.
4 5 6 |
# File 'lib/ankh/validations/human_validator.rb', line 4 def initialize( = {}) @options ||= end |
Instance Method Details
#validate(record) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/ankh/validations/human_validator.rb', line 8 def validate(record) if has_valid_answer?(record) record.errors.add(:human_answer, @options[:message] || "is not valid") end record.human_answer = "" end |