Class: OrgnoValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/orgno_validator.rb

Class Attribute Summary collapse

Instance Method Summary collapse

Class Attribute Details

.orgno_mod_11_weightsObject

Returns the value of attribute orgno_mod_11_weights.



17
18
19
# File 'lib/orgno_validator.rb', line 17

def orgno_mod_11_weights
  @orgno_mod_11_weights
end

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



5
6
7
8
9
# File 'lib/orgno_validator.rb', line 5

def validate_each(record, attribute, value)
  unless OrgnoValidator.valid_orgno?(value)
    record.errors.add(attribute, options[:message] || :invalid)
  end
end