Sha256: a5cad0dcbac60be263cf9752110b4b020b50e09a5c69db571fce02074dfd1193

Contents?: true

Size: 542 Bytes

Versions: 2

Compression:

Stored size: 542 Bytes

Contents

module BitcoinActiveRecord::Models::Payment
  extend ActiveSupport::Concern

  included do
    # sender's address for received payments
    # payee address for sent payments
    belongs_to(:btc_address, inverse_of: :payments)

    has_one(:received_payment, inverse_of: :payment)
    has_one(:sent_payment, inverse_of: :payment)

    validates(:txid, :btc_address, :amount, presence: true)
    validates(:amount, numericality: { greater_than_or_equal_to: 0 })
    validates(:txid, uniqueness: true)

    auto_strip_attributes(:txid)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bitcoin_active_record-0.0.2 lib/bitcoin_active_record/models/payment.rb
bitcoin_active_record-0.0.1 lib/bitcoin_active_record/models/payment.rb