Sha256: 9344495f7a15fa90967d67f5ea7fde7cbfd4a050c09353cbc43f3b10ebb315d9

Contents?: true

Size: 609 Bytes

Versions: 4

Compression:

Stored size: 609 Bytes

Contents

class Spree::Bid < Spree::Base
  belongs_to :auction, class_name: 'Spree::Auction'
  belongs_to :bidder, class_name: 'Spree::User'

  validates :auction_id, presence: true
  validates :bidder_id, presence: true
  validates :amount, presence: true

  extend Spree::DisplayMoney
  money_methods :amount

  scope :accepted, -> { where(accepted: true) }
  scope :visible, -> { where(visible: true) }
  scope :delinquent, -> { where(delinquent: true) }
  scope :not_delinquent, -> { where(delinquent: false) }

  def is_autobid?
    !visible && accepted
  end

  def bidder_display_name
    bidder.email
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solidus_auction-0.0.6 app/models/spree/bid.rb
solidus_auction-0.0.5 app/models/spree/bid.rb
solidus_auction-0.0.4 app/models/spree/bid.rb
solidus_auction-0.0.3 app/models/spree/bid.rb