I have an existing table bases
with a column sub_type
where the values of sub_type
match to some existing classes that I want to use for Single Table Inheritance, but the class names don't exactly match the values in the column.
For example, I have:
class Base
class SubClass1 < Base # stored in 'sub_type' as 'sub_class_1' instead of 'SubClass1'
class SubClass2 < Base # stored in 'sub_type' as 'sub_class_2' instead of 'SubClass2'
Is there a way to get rails to correctly map between the name 'sub_class_1' and the class 'SubClass1' without renaming the classes or rewriting the values in the database?