Sha256: 7de96322793445cd27cb36d38cf1ba84f24efcaf10997c731cdd30e67a6a571a
Contents?: true
Size: 1.06 KB
Versions: 14
Compression:
Stored size: 1.06 KB
Contents
module Ticket::Transfers extend ActiveSupport::Concern def sell_to(buyer, time=Time.now) begin self.buyer = buyer self.sold_at = time self.sell! rescue Transitions::InvalidTransition return false end end # # Deals solely with changing the buyer. Pricing should be handled in exchange_prices_from # def exchange_to(buyer, time=Time.now) begin self.buyer = buyer self.sold_at = time self.exchange! rescue Transitions::InvalidTransition => e puts e return false end end def comp_to(buyer, time=Time.now) begin self.buyer = buyer self.sold_price = 0 self.sold_at = time self.comp! rescue Transitions::InvalidTransition => e puts e return false end end def return!(and_return_to_inventory = true) and_return_to_inventory ? return_to_inventory! : return_off_sale! remove_from_cart self.buyer = nil self.sold_at = nil self.buyer_id = nil Rails.logger.debug(self.inspect) self.reset_price! save end end
Version data entries
14 entries across 14 versions & 1 rubygems