Hi all! I have to build a webapp for a friends GYM. I’ve done basic
stuff before with rails, but just need to clarify something before I
start this.
The site will have a top-level model for the GYM, and under that I need
models to represent the equipment that will be loaned out, customers
etc.
so gym->has_many->items
where I’m getting stuck though, is that each Item isn’t really a model
itself.
I.E a loanable item has many sub-items, which represent the version
(serial number,qty of this version,loaned to, etc) of the actual item.
So would the models be:
gym,item,version,customer:
gym :has_many=>:items
item :has_many=>:versions
version :has_one=>customer
i want the item model to have a current stock level thoguh, for example.
Would that just be a case of adding a qty method to its model and
iterating through each of its children?
thanks for reading!