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?

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.

--
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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/d6802541-155f-4a95-8f6a-e6617e65152c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Colin Law at Nov 16, 2014 at 7:56 am

    On 16 November 2014 03:14, Clay McCullough 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 rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    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.
  • Clay McCullough at Nov 16, 2014 at 3:48 pm
    Well the auction object needs to be the auction itself, where users join and bid... If my reasoning is flawed I would love some ideas.

    As for the bidding, I was thinking that instead of there being a highest bidder, I would simply have a button that the users could click that would increase the price by one dollar every time. Is there a way I could do this?
    Clay

    --
    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 rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/813f7ada-5c60-4915-aa04-606838ecc725%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Colin Law at Nov 16, 2014 at 4:00 pm

    On 16 November 2014 15:48, Clay McCullough wrote:
    Well the auction object needs to be the auction itself, where users join and bid... If my reasoning is flawed I would love some ideas.

    As for the bidding, I was thinking that instead of there being a highest bidder, I would simply have a button that the users could click that would increase the price by one dollar every time. Is there a way I could do this?
    Are you just thinking of keeping track of the current price and which
    user it is then? I think there may be a problem with that, I think
    you will need to track the history of all bids in case there is a
    dispute from a user. Without the full history you would not be able
    to demonstrate the sequence of +1s

    Also what would happen if 500 users all clicked the +$1 within a
    second of each other? The last one could end up having made a bid
    $499 more than he anticipated.

    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 rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLu8%2BTfd4Np7XmZfRrz_3aNDUofmREEU1O2uuefT%3DWzOjg%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Clay McCullough at Nov 16, 2014 at 4:11 pm
    Exactly. These are some problems I haven't figured out how to solve! This is my first web application. I have thought about all users clicking at the same time... What would be a good way to keep track of the users, have a record of the bidding, and increment the price the same amount every time? Would it be a method in the model or controller or what?

    --
    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 rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/07d7babf-bd03-402c-8296-a5cf85448a3c%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Colin Law at Nov 16, 2014 at 4:40 pm

    On 16 November 2014 16:11, Clay McCullough wrote:
    Exactly. These are some problems I haven't figured out how to solve! This is my first web application. I have thought about all users clicking at the same time... What would be a good way to keep track of the users, have a record of the bidding, and increment the price the same amount every time? Would it be a method in the model or controller or what?
    Please quote the previous message when replying and insert your
    comments at appropriate points, it makes it easier to follow the
    thread. Otherwise someone seeing your previous message will have no
    idea what you are saying 'exactly' to. Thanks.

    Don't worry about where methods go yet, get the models and
    associations sorted. It seems to me you are going to have to have
    auctions, users, bids with appropriate associations. The +1 button
    should not show +1 but show the new bid amount (current + 1) and that
    value should be posted when he clicks, so there is no confusion over
    the amount he is bidding. By keeping all the bids in the database
    then you have a history of what happened.

    You will need something like
    user has many bids
    auction has many bids
    bid belongs to user
    bid belongs to auction

    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 rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsK2oU5NNAZ7Uw30NQb9kDsMVK1%2BDM6Aaq-opNtXTa2Qg%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Clay McCullough at Nov 16, 2014 at 5:03 pm

    On Sunday, November 16, 2014 10:40:33 AM UTC-6, Colin Law wrote:
    On 16 November 2014 16:11, Clay McCullough <cla...@kc.rr.com <javascript:>>
    wrote:
    Exactly. These are some problems I haven't figured out how to solve!
    This is my first web application. I have thought about all users clicking
    at the same time... What would be a good way to keep track of the users,
    have a record of the bidding, and increment the price the same amount every
    time? Would it be a method in the model or controller or what?

    Please quote the previous message when replying and insert your

    comments at appropriate points, it makes it easier to follow the
    thread. Otherwise someone seeing your previous message will have no
    idea what you are saying 'exactly' to. Thanks.
    Ok sorry, im learning :) this is my first post here.

    Don't worry about where methods go yet, get the models and
    associations sorted. It seems to me you are going to have to have
    auctions, users, bids with appropriate associations. The +1 button
    should not show +1 but show the new bid amount (current + 1) and that
    value should be posted when he clicks, so there is no confusion over
    the amount he is bidding. By keeping all the bids in the database
    then you have a history of what happened.
    Ok! yes that makes sense. that way my users wont be confused or the system
    hopefully wont be broken if there is a lot of activity at the same time.

    You will need something like
    user has many bids
    auction has many bids
    bid belongs to user
    bid belongs to auction

    Colin
    Alrighty. That is what I thought i would need to do for the associations.
    Thanks for your help Colin, I will do some more reading on those
    associations in the Rails Guides. I will need help with the methods once I
    have that established, if you dont mind. Thanks for your time.
    Clay

    --
    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 rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/fd62e6fa-eae7-40cb-b907-bfbf6c2194dc%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Colin Law at Nov 16, 2014 at 8:16 pm

    On 16 November 2014 17:03, Clay McCullough wrote:
    ...
    Alrighty. That is what I thought i would need to do for the associations.
    Thanks for your help Colin, I will do some more reading on those
    associations in the Rails Guides. I will need help with the methods once I
    have that established, if you dont mind. Thanks for your time.
    Can I check that you have already worked right through a good tutorial
    such as railstutorial.org (including doing the exercises and so on).
    If not then I highly recommend doing so, it will save you (and us)
    time in the long run.

    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 rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLuonz%3DWrcZGx6HpzBqGeCjuqaPN1R3KGeg3%2Buouz5LK6w%40mail.gmail.com.
    For more options, visit https://groups.google.com/d/optout.
  • Clay McCullough at Nov 16, 2014 at 8:21 pm
    I started it but never finished it. I will go through it all a did I have any more questions I will let you know: thanks for your help Colin... Have a good one.

    --
    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 rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/4f2e2ee7-85d3-42ff-b181-d8e4bd6abac9%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Clay McCullough at Nov 16, 2014 at 8:23 pm
    No I did not finish that... I will try to finish it and if I have any more questions, I will let you know. Thanks 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 rubyonrails-talk+unsubscribe@googlegroups.com.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/091ee23f-9d73-4bc3-bdfd-4aa260995e70%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedNov 16, '14 at 3:14a
activeNov 16, '14 at 8:23p
posts10
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Clay McCullough: 6 posts Colin Law: 4 posts

People

Translate

site design / logo © 2022 Grokbase