Sha256: 90b16a403a6f766b440a9d698517910d340f21c8b0950afd80893df75d1554bd
Contents?: true
Size: 824 Bytes
Versions: 8
Compression:
Stored size: 824 Bytes
Contents
module StripeLocal class Card < ActiveRecord::Base self.primary_key = :id has_many :charges, inverse_of: :card belongs_to :customer, inverse_of: :cards class<<self def create attrs_hash super normalize( attrs_hash ) end def normalize hash hash.each_with_object({}) do |(k,v),h| key = case k.to_sym when :customer then :customer_id when :type then :brand when ->(x){attribute_method? x} then k.to_sym else next end h[key] = v end end end # =!=#>>> # string :id # string :customer_id # string :name # integer :exp_month # integer :exp_year # string :brand # string :last4 # string :cvc_check # string :fingerprint # =ยก=#>>> end end
Version data entries
8 entries across 8 versions & 1 rubygems