# Very special app design question

**URL:** <https://www.ruby-forum.com/t/very-special-app-design-question/148060>\
**Category:** Rails\
**Created:** [September 8, 2008, 8:11pm UTC](https://www.ruby-forum.com/t/very-special-app-design-question/148060 "2008-09-08T20:11:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![christoph](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/eb8c5e/32.png) [@christoph](https://www.ruby-forum.com/u/christoph)\
**Post date:** [September 8, 2008, 8:11pm UTC](https://www.ruby-forum.com/t/very-special-app-design-question/148060/1 "2008-09-08T20:11:35Z")

</div>

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: [http://bayimg.com/dAkaKAAbh](http://bayimg.com/dAkaKAAbh) 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:  
[http://bayimg.com/DakAjaaBH](http://bayimg.com/DakAjaaBH). 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.

Christoph

---

<div class="post-metadata">

**Author:** ![christoph](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/eb8c5e/32.png) [@christoph](https://www.ruby-forum.com/u/christoph)\
**Post date:** [September 8, 2008, 9:03pm UTC](https://www.ruby-forum.com/t/very-special-app-design-question/148060/2 "2008-09-08T21:03:25Z")

</div>

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.
