Created
October 11, 2011 11:28
-
-
Save fidel/1277861 to your computer and use it in GitHub Desktop.
CC validation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Validations | |
class Validations::ExpiryMonthValidator < ActiveModel::EachValidator | |
include ActiveMerchant::Billing::CreditCardMethods | |
def validate_each(record, attribute, value) | |
record.errors[attribute] << 'is not a valid month' unless record.valid_month?(value) | |
end | |
end | |
end | |
ActiveModel::Validations::ExpiryMonthValidator = Validations::ExpiryMonthValidator |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment