Sha256: a5aac608d9e75a9203fb0883a213967b679e0ed19ef9a799dde3396172235f76
Contents?: true
Size: 620 Bytes
Versions: 1
Compression:
Stored size: 620 Bytes
Contents
module Trade module Model::CardPrepayment extend ActiveSupport::Concern included do attribute :token, :string attribute :amount, :decimal attribute :expire_at, :datetime belongs_to :card_template before_validation :update_token, if: -> { new_record? } end def update_token self.token = generate_token self end def qrcode_url url = Rails.application.routes.url_for(controller: 'trade/my/cards', action: 'token', token: token) QrcodeHelper.data_url(url) end def generate_token UidHelper.nsec_uuid 'CP' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rails_trade-0.0.3 | app/models/trade/model/card_prepayment.rb |