Let's say I have a FireNinja < Ninja
object in my database, stored using single table inheritance. Later, I realize he's really a WaterNinja < Ninja
. What's the cleanest way to change him to the different subclass? Even better, I'd love to create a new WaterNinja
object and just replace the old FireNinja
in the DB, preserving the ID.
Edit
I know how to create the new WaterNinja
object from my existing FireNinja
, and I also know I can delete the old one and save the new one. What I'd like to do is mutate the class of the existing item. Whether I do that by creating a new object and doing some ActiveRecord magic to replace the row, or by doing some sort of crazy thing to the object itself, or even by deleting it and reinserting with the same ID is part of the question though.