I'm building an app which will allow a user to scan the barcode on a 'shelf', 'box' or 'product' which will then bring up that particular item or all the associated items.
As these are all separate models with their own ID's, I need a global ID table.
I was thinking of a polymorphic table called 'barcodes'
barcodes
- id
- barcode_number
- barcodable
Is there an easy way to do this? Or is polymorphic the best way?