I have a User model who has one Profession (Designer, Model, Photograph, …). Each profession has specific attributes, so each profession has its own table.
Now in my User I would like to say that a User has_one :profession, where the profession is Photograph, Designer, or whatever else.
My first idea was to use the Profession model as a STI but if I do this I cannot have a table for each real profession…
How would you design this?
Thanks,
Greg
I would flip the
has_oneassociation to abelongs_toand use polymorphic associations. The model code would be:Migration would look like this: