Multiple Relationships with single attribute.

I'm setting up my resources (Flower Shop). I have a people resource and an order resource. My order resource will have at least 3 attributes that can be people. a person can be the *designer *of an order, a person can be the *salesperson *for an order, and a person could be the *driver *for an order. I've struggled to find a good example of this.
2 Replies
ZachDaniel
ZachDaniel3y ago
Hey there! There is no problem having many relationships to the same resource. In your case:
relationships do
belongs_to :designer, Person
belongs_to :sales_person, Person
belongs_to :driver, Person
end
relationships do
belongs_to :designer, Person
belongs_to :sales_person, Person
belongs_to :driver, Person
end
The relationships only need to be unique on their name
lifeling
lifelingOP3y ago
Awesome. Thanks!

Did you find this page helpful?