Sha256: dfaca39b5c27941ffc910054374e3e5352832b7a07a176a05881d1565d1fedf5
Contents?: true
Size: 665 Bytes
Versions: 5
Compression:
Stored size: 665 Bytes
Contents
require 'aasm' module PuntoPagosRails class Transaction < ActiveRecord::Base include AASM belongs_to :resource, class_name: PuntoPagosRails.resource_class_name delegate :amount, :to => :resource aasm :column => :state do state :pending, :initial => true state :completed state :rejected event :complete do transitions :from => :pending, :to => :completed end event :reject do transitions :from => :pending, :to => :rejected end end def reject_with(error) self.error = error self.reject end def amount_to_s "%0.2f" % amount.to_i end end end
Version data entries
5 entries across 5 versions & 1 rubygems