Change the value stored in inheritance_column

I have been struggling for quite sometime with this.

Is there any way to configure the Model to store user defined value in
the inheritance_column instead of the default value (which is

The problem I have is like this:

I have a User model and there are different models which inherit from
this like Admin, Premium, Professional, etc.
Each of these inherited models are identified by a field named role_id
in the users table and it contains integer values for e.g. 1 for
Admin, 2 for Premium, 3 for Professional and so on.

I want to set this role_id field as the inheritance_column, which can
be easily done by specifying :inheritance_column => "role_id" in the
User Model. But how do I configure Rails to store these numerical
values in the role_id field, instead of the Class name?

I will really appreciate if anybody can help me out with this.

Well you could overwrite those fields yourself, but then bad things would happen when you loaded one of those objects because Rails would try to create an instance of 1 instead of an instance of Admin. I don't believe there's any support for this in rails (not to say that it couldn't be done but you would have to change rails itself)


When I couldn't find it in the documentation, I thought that it might
be the case.

Rails has strong opinion about certain things and if you try to work-
around then it makes the life miserable.