I want to have a Status
model which will be relatively static after some user-defined set up (and different users may have different values on status).
The status can apply to different models, such as Contact
and Event
.
so the statuses returned by contact.status
will be different from event.status
I want to design the app so that status table has different types (contacts
and events
).
What is the right strategy and format for this?
I am thinking of declaring :has_one Status
in the Contact
model,
and storing a :status_id
in the :contacts
table. Ditto with Event
.
:statuses
table will have the status value, type, and date.
does this make sense? Can you suggest a better approach?
There is a guide on this very question. Your situation is slightly different in that it seems as though your Status model really needs to be polymorphic since different things will be 'statusable'.
To answer your question, Contact/Event has_one Status does make sense to me.