Class: RegonValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- RegonValidator
- Defined in:
- lib/common_numbers_rails/regon_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
6 7 8 9 |
# File 'lib/common_numbers_rails/regon_validator.rb', line 6 def validate_each(record, attribute, value) @message = [:message] || "invalid format" record.errors[attribute] << "invalid format" unless CommonNumbers::Polish::Regon.new(value).valid? end |