Stock

is there an easy way, or hard way, to have amount of items, and as
they’r been sold the amount or quantity be subtructed, and as they are
added, the amount or quantity grows, ? I can see that everybody wants to
sell but nobody wants to know whether there’s avalibale items, I guess
items are endless in almost everybody’s world, but not mine, i work with
items that do finish and sometiems I never have them again,
Ok it’s like inventory thing
It’s just, that there’s no information avalibale that I know of
almost all the manuals, and books, the example application is about
selling books
is that the only thing this world sells? I say this because books
probably don’t have the problem of aviability, so they donn’t show you
how to keep track of your items
ok, It’s probably my lack of skill, to know how to do it, I’ll just have
to keep practicing, because I’m very new at web or anything related with
sofware
if someome knows where I can get iformation about it, I’ll apriciate it,
if not, then I’ll have to be on my own, it feels so frightening

Problems like this are exactly why people use programming languages to
“program” software.

This is no different than the book examples you have read – you just
want
to also have the concept of stock levels.

This is applicable to the book world as well. Amazon’s book selling
system
is aware of its stock levels. Powell’s is aware of its stock levels.
However, unless they are really cool, the Paperback Book Exchange store
down
the street doesn’t.

What do you do?

Create a StockLevel model, that will “belong to” your Product class (in
the
case of the book store it might just be a Book class… if the types of
products you are going to offer are all going to be different “models”
then
you’ll probably want to use polymorphic associations for your stock
levels
instead of a simple association).

Make a controller for your vendor to add stock to the product ( each row
of
stock level would have a float column with positive or negative
allocations
of stock made. )

When someone purchases one or more products, add an instance to your
StockLevel model with the number the customer bought as a negative.

In your store logic, you can choose to show or not show your Products
based
on their availability.

This is one way to solve the problem with or without Rails. Rails though
will certainly make this dead simple with very clean and readable code.
You’ll find yourself building methods like Product#add_stock(5),
Product#subtract_stock(1), Product#current_stock_level (which would just
do
a simple product.stock_levels.calculate(:sum, :level) ), etc.

Hope this helps you conceptualize what you’ve got in front of you.

D. Taylor S.,
Reality Technician
http://realitytechnicians.com