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 33,399+ 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.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.