Reputation: 209
I have a model Project
with a field Type
. I'd like Type
to be a second model with it's own set of attributes that should be accessible from project (i.e., project.type.name
or project.type.attribute
).
A Project
would only have one type, but I'm not sure what association to use on Type
, as belongs_to
doesn't seem to fit the bill. What's the right way to structure these models where one model is a standard set of attributes?
Upvotes: 0
Views: 21
Reputation: 9002
The question is: can multiple projects can share a single type?
If yes then Project
should belong_to :type
and conversely Type
has_many :projects
Upvotes: 1