STI with numeric keys as types


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,