0

I am building an inventory tracking tool to help people track either unique items (one-offs - say a vintage T-Shirt) or groups of items (a T-shirt design where I have a quantity). The data structures will be very similar, so that:

**Item**
Title
Status (sold, for sale) <- right now this is a simple array
Location <- this is a relationship to a diff model
etc...


**Item Group**
Title
Quantity
Status ([quantity] sold, [quantity] for sale) <- this should be an hstore??
Locations ([quantity] location1, [quantity] location2) <- not sure about this yet!
etc...

I'm expecting to use different forms to gather this information, as too much complexity on the form to accommodate these differences will add difficulty for my user group.

So my questions are as follows:

What is the best data solution for this? Do I want to have two models/controllers or try to extend the Item model? How do people usually handle this sort of issue?

I do have the requirement that I need to show the user all of their inventory (items and groups) at once, but this seems the smaller task to me.

4

1 回答 1

0

Reduce your headaches and don't differentiate between unique items and non-unique ( ie, all items have a quantity ).

Then you want a "purchace" model, and then a "item_purchace" model to act as a join table.

Following the layout here: guides.rubyonrails.org...

于 2013-11-10T19:43:48.360 回答