class ActiveModel::Validations::LuhnAlgorithmValidator

active model validator for Luhn Algorithm

Public Instance Methods

validate_each(record, attribute, value) click to toggle source
# File lib/luhn_algorithm/validator.rb, line 7
def validate_each(record, attribute, value)
  return if LuhnAlgorithm.valid?(value)
  record.errors.add(attribute, options[:message] || :invalid)
end