Hi All,
I want to know, what is a rails way of converting a subclass record to another subclass record, just changing type isn't working and also superclass to subclass and vice versa.
Thanks in advance
Markiv
Hi All,
I want to know, what is a rails way of converting a subclass record to another subclass record, just changing type isn't working and also superclass to subclass and vice versa.
Thanks in advance
Markiv
All you should have to do is change the type field. Make sure you save the record, and reload the Ruby object from the database.
If that doesn't work, can you provide some Ruby code that isolates the problem?
Are you asking how to change an object that is a subclass to different subclass of it's superclass? This isn't really possible in the OO scheme of things. It's possible to cast an object from a superclass to a subclass, but you can't cast it back, since the object may now contains variables and methods that the superclass does not.