class ActiveModel::Validations::CreditCardNumberValidator

Public Instance Methods

validate_internal() click to toggle source
# File lib/credit_card_support/validators/credit_card_number_validator.rb, line 56
def validate_internal
  if !@value.luhn?
    @record.errors.add(
      @attribute,
      :luhn_not_valid,
      options.merge(message: options[:message] || t(:luhn_not_valid))
    )
    false
  else
    true
  end
end