Module: HungryForm::Elements::CheckboxField::Validator

Defined in:
lib/hungryform/elements/checkbox_field.rb

Overview

Overriding the Validator methods

Class Method Summary collapse

Class Method Details

.required(element, rule) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/hungryform/elements/checkbox_field.rb', line 21

def self.required(element, rule)
  if rule.respond_to? :call
    rule.call(element)
  else
    'is required' if element.value == 0 && rule
  end
end