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 ?

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).

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs