Reputation: 75975
I have a rails project and have a model customers
and suppliers
. I have a sqlite database table called people
. In the customers model I only want to show data from the people table where type=customer
and the supplier to only show data from the people table where type=supplier
Its crucial I use the same table for both the models. How would I make the customer model only display type=customer
?
Upvotes: 1
Views: 157
Reputation: 1532
Go for single table inheritance. single table inheritance
where u need to inherit customers
and suppliers
from people
.
Upvotes: 3