Topic: Modelling a model on another model
Im building a shopping cart style of thing at the moment for kicks, now the items once selected and paid for will go through several stages. 'On hold', 'Out of Stock', 'Ready to ship' that kind of thing, so ive been using validates_inclusion_of on the items model like so..
validates_inclusion_of :status, :in => ['On hold', 'Out of Stock', 'Ready to ship']
I then had a bit oif an idea, what if I make the status a model itself then I make one belong to the other. So I did, that in itself is working, but is there any way I can validate items model so that the status has to exist in the status model, so something like...
validates_inclusion_of :status_id, :in => ItemsStatus.find_all
Can that be done?