Hi,
I'm using single table inheritance to handle customer baskets, sales orders, sales invoices etc...
Due to this I don't really want to use the table id as the order reference, invoice number etc as the baskets would likely send the numbers rocketing into unnecessarily large figures, with potentially large number gaps between sequential orders.
That is one order might have order number 1000, and the next confirmed order might end up with 1030.
I need to be able to generate a next sequential number once the order is confirmed and this becomes its order number. In the past I might have a table with one row that contains an integer that is incremented for each confirmed order. How would this best be tackled via ActiveRecord?
I've thought of creating a model for ConfirmedOrder that just contained a number field but it seemed a little wasteful and creates an unnecessary association.
Maybe the STI is causing me headaches but it seemed eaiser given that these documents all have such similar contents. Any thoughts?
Thanks, Andrew.