Very special app design question

Hi all ! I'm currently developing a game using Ruby On Rails and have a question on how to design my controller, given the following concept: There are the following models: Product, Offer, Storage, User (and others, of course). Users can create offers for their products and of course, they can buy them. A Offer is associated with ONE product, so if you create 5 offers, there will be 5 INSERT statements.

Example: A User creates an Offer for beer (a Product), he produced and he sees something like this: bayimg - image: selling-beer.png - free uncensored image hosting So he selects an amount, and in the create action I'm doing something like (simplified):

params[:amount].to_i.times do   Offer.create… end

If the User selects 6 as amount, there will be 6 different Offers in the database, each linked to another product. When I list the offers for buying, I want to provide this interface: Now there's a problem (from my point of view). If (another) User selects 3 as amount of beer to buy, how can I fetch the right Offers from the database ?

I'm actually doing something like providing a "master" offer_id to the buy-action and fetching an offer. Then I know about the product and fetch all offers with the same product-"types" like the first offers. I hope there's anyone who understands what I've written. My question is, does anyone knows a better idea how to handle this. This is surely not a everyday problem, but I hope your guys are creative^^.

If you have any questions, cause you didn't understand me, I will answer them ! Thank you very much in advance.


This is a bit to confusing to me. You should first have to write a story, a game story. Try to make it as descriptive as that other developers could understand your idea and could programmed it base on that story. Deliberately Rspec is not mentioned as you should be able to state your story in plain English. Ounce you get it done everything will come to it's place.