Class: Spree::BidsController
- Inherits:
-
StoreController
- Object
- StoreController
- Spree::BidsController
- Defined in:
- app/controllers/spree/bids_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/spree/bids_controller.rb', line 17 def create @auction = Spree::Auction.find(params[:auction_id]) if spree_current_user @bid = Spree::Bid.create(auction: @auction, bidder: spree_current_user, amount: params[:amount]) @recorded_bid, = @auction.receive_bid(@bid) if @recorded_bid flash[:success] = else flash[:error] = end else flash[:error] = Spree.t("must_be_signed_in_to_bid") end redirect_to auction_path @auction end |
#index ⇒ Object
2 3 4 5 |
# File 'app/controllers/spree/bids_controller.rb', line 2 def index @auction = Spree::Auction.find(params[:auction_id]) @bids = @auction.visible_bids_in_chron_order end |
#new ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/spree/bids_controller.rb', line 7 def new @auction = Spree::Auction.find(params[:auction_id]) if spree_current_user @bid = Spree::Bid.new(auction: @auction) else flash[:error] = Spree.t("must_be_signed_in_to_bid") redirect_to auction_path @auction end end |