Sha256: e92c29215cf7f82e463b0c24a48b87e8158685714827752463d33e26cc6579f5

Contents?: true

Size: 556 Bytes

Versions: 3

Compression:

Stored size: 556 Bytes

Contents

module SimpleCart
  class CreditCard < ActiveRecord::Base
    belongs_to :user
    belongs_to :order

    validates :number, :cvv, :expiration_year, :expiration_month, :firstname, :lastname, presence: true
    validates :number, :cvv, :expiration_year, :expiration_month, numericality: true
    validates :number, :length => { :is => 16 }
    validates :cvv, :length => { :is => 3 }


    def name
      number
    end

    def self.months
      ('01'..'12').to_a
    end

    def self.years
      (Time.now.year+1..Time.now.year+50).to_a
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simple_cart-0.0.5 app/models/simple_cart/credit_card.rb
simple_cart-0.0.4 app/models/simple_cart/credit_card.rb
simple_cart-0.0.3 app/models/simple_cart/credit_card.rb