Return to Snippet

Revision: 62950
at March 26, 2013 06:34 by Fivell


Updated Code
#add gem 'credit_card_validations' to Gemfile


class CreditCard < ActiveRecord::Base
validates :number, presence: true, credit_card_number: {brands: [:amex, :maestro]}
end

Revision: 62949
at March 26, 2013 06:26 by Fivell


Initial Code
#add gem 'credit_card_validations' to Gemfile



validates :number, presence: true, credit_card_number: {brands: [:amex, :maestro]}

Initial URL
https://github.com/Fivell/credit_card_validations

Initial Description
Supported brands
    
    name             | key
    -----------------------
    American Express | :amex
    China UnionPay   | :unionpay
    Diners Club      | :diners
    Dinner Club US   | :diners_us
    Discover         | :discover
    JCB              | :jcb
    Maestro          | :maestro
    MasterCard       | :mastercard
    Solo             | :solo
    Visa             | :visa

Initial Title
Validate credit card

Initial Tags
rails, ruby

Initial Language
Rails