Storing different types of data and not using the rest

I have a schema with multiple fields
type → is an Enum that can have values of [:color, :number]
color → a foreign key to colors table
number → a foreign key to numbers table

What I want is, when the (type) field is (color) I want to get the color foreign key,

I want this schema to act like a switch, that can store different types of data

You can use polymorphic_embed probably.