class ActiveModel::Validations::CreditCardValidator

Public Instance Methods

t(code, *args) click to toggle source
# File lib/credit_card_support/validators/credit_card_number_validator.rb, line 17
def t(code, *args)
   I18n.t("credit_card_support.validators.number.messages.#{code}", *args)
end
validate_each(record, attribute, value) click to toggle source
# File lib/credit_card_support/validators/credit_card_number_validator.rb, line 7
def validate_each(record, attribute, value)
  @record     = record
  @attribute  = attribute
  @value      = "#{value}".strip.gsub(/ /, '') # remove random whitespace

  @value.extend(CreditCardSupport::CreditCardNumber)

  validate_internal
end