hei
2008-Mar-18 06:06 UTC
How: obj-class-A = A.new(obj-class-B) ? suppose class A is subset of class B
RT~ I mean create an object a-A by another object b-B. a-A is object of class A, b-B is object of class B. suppose A is ''subset'' of B, em, I mean, all the attributes A have, you can find attributes with the same name in B. How can I gain this? re-write the ''new'' method in A? or just define another method create_via_B(b-B)? so how ? --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
AndyV
2008-Mar-18 12:04 UTC
Re: How: obj-class-A = A.new(obj-class-B) ? suppose class A is subset of class B
I''m not sure if I fully understand what you''re trying to describe but it sounds like you want to look into Single Table Inheritance (STI). On Mar 18, 2:06 am, hei <cy...-KN7UnAbNpbg@public.gmane.org> wrote:> RT~ > I mean create an object a-A by another object b-B. > a-A is object of class A, b-B is object of class B. > suppose A is ''subset'' of B, em, I mean, all the attributes A have, you > can find attributes with the same name in B. > How can I gain this? re-write the ''new'' method in A? or just define > another method create_via_B(b-B)? so how ?--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---