class ActiveModel::Validations::CreditCardValidator
Public Instance Methods
validate_each(record, attribute, value)
click to toggle source
# File lib/active_validators/active_model/validations/credit_card_validator.rb, line 6 def validate_each(record, attribute, value) brand = options.fetch(:type, :any) brands = (brand == :any ? [] : Array.wrap(brand)) record.errors.add(attribute) if value.blank? || !ActiveCreditCardBrand.new(value).valid?(*brands) end