Multiple table inheritance

Hi there

I've got a question about Multiple Table Inheritance.
In my app i have owners and buyers.
I'd like to use a Identity model for common fields (name, adress,
phone, email) and two inherited models (buyer criteria on one side and
more informations about owner on the other side). I've seen gems on
github allowing to do this with ease except one thing : What about the
owner being also a buyer. I mean it deals with a second hand car
business. I mean the guy that comes in the shop to sell his cars and buy
a new one is a reality.

So in my dreams i'd like to have :
-Identity model (name, phone, email, adress)
-Buyer model inherited from Identity (budget, type, number_of_seats,
....)
-Owner model inherited from Identity (few others fields), which i'd like
to be a nested resources of the car model

Any ideas ?

Thanks

Philip

Yeah, I dealt with a brokerage type of business once. Thinking that you have buyers & sellers is a mistake. You have companies (or people). Some companies buy, some sell, some both.

Hi scott

Thanks for ur answer

As you guess i'm a newbie in Rails
I agree with your answer.
But technically i still need to find my way.

I will make some tries and certainly post again there

I believe Scott is suggesting that you just have one class, User or
Person or Company or whatever is appropriate, and put all the
necessary data to allow them to be sellers, buyers or both in that one
table. I believe that is what I would do. The simplest solution is
often the best.

Colin

Yup, I'd be looking at a Person/Company model (or Client, or whatever
your main description is of who makes the trades), and then have a
Sale model which has an associated Buyer and Seller (which both link
to the same Person/Company/Client model.

If you want to know who all the Buyers are, have a named scope on
P/C/C to return all those who are associated to Sales as Buyers, and
vice versa for Seller.