Forum: Ruby on Rails STI with numeric keys as types

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
576a62ab2a73c118974f8e5b0e7458dc?d=identicon&s=25 (Guest)
on 2007-01-06 19:17
(Received via mailing list)

I wish to use single table inheritance with a legacy database. The
problem is that the "type" column holds numeric keys instead of strings
(because or performance issues blah blah...)

For example, in a table 'Components'  the value 1 in type means that I
have a DialogComponent, 2 means ProcessComponent, ...

I'd like to have models like this :
class Component < ActiveRecord::Base; end;
class DialogComponent < Component; end;
class ProcessComponent < Component; end;

but I can't see how to achieve this.

Thanks for your help,

This topic is locked and can not be replied to.