On 16 November 2014 03:14, Clay McCullough <[email protected]> wrote: > hello... I'm trying to start an auction site and I need some help with the > modeling of auctions and bids. > > Would it be better to have auctions have many bids and bids belong to > auctions, or > Auction has one bid, bid belongs to auction?
What does an Auction object represent? It may help to tell us some of the attributes of Auction to give us a better understanding. Having answered that the question is how many bids are associated with an auction? If the answer is many then it you must use auction has many bids, otherwise it would only be able to be associated with one bid. > > Also, how would I call the bid object on the auction to change the > :current_price attribute on auction, increment info it up by 1 dollar? Thanks > for your help. Is the current price the highest of the prices in the bids? In which case you should probably not store the current price at all, but work it out when needed from the associated bids. Only have it stored separately if it becomes a performance issue as it will likely complicate the code significantly. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsQgkAuz18T-JTu5NLeYGhW-B_9URXyDUSAn63x8WNo6w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

