All threads / Bidding App
Ask A Question

Notifications

You’re not receiving notifications from this thread.

Bidding App

Ryan Carter asked in Rails

I am building a website with a very specific way they want items bid on. That would be the initial bid will always be $125 and each additional bid will increase by exactly $25. So $125, $150, $175, etc.

What would be the best way to do this?

Hey Ryan,

I would probably create like a Bid model that kept track of these. Since you don't want to charge until the very end of the auction, you'll want to keep track of the bid history and then charge the winner (or runner up in case something falls through, etc).

Then you'd just add validations to check against previous bids for the product and make sure they're $25 more than the last.

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 62,493+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2022 GoRails, LLC. All rights reserved.