Sha256: 16140efec24550df95d49414ee4ea69be69fa874a8e9b7846e2223326838a74c
Contents?: true
Size: 499 Bytes
Versions: 5
Compression:
Stored size: 499 Bytes
Contents
require "active_support/concern" module PuntoPagosRails module Payable extend ActiveSupport::Concern included do has_many :transactions, as: :payable, class_name: "PuntoPagosRails::Transaction" def paid? return false unless transactions.any? transactions.last.completed? end end module ClassMethods def by_token(token) transaction = Transaction.find_by(token: token) transaction.try(:payable) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems