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 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Nov 6, 2011, at 1:08 PM, Philippe M. wrote:> Any ideas ?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. -- Scott Ribe scott_ribe-ZCQMRMivIIdUL8GK/JU1Wg@public.gmane.org http://www.elevated-dev.com/ (303) 722-0567 voice -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 6 November 2011 22:48, Philippe M. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> 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 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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 7 November 2011 08:51, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 6 November 2011 22:48, Philippe M. <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> I agree with your answer. >> But technically i still need to find my way. > > 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.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. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.