Single table inheritance for different user types?

First of all, I wanted to give a harty “thank you” to James A.s for
creating rails engines, which seems like a very natural way to increase
codesharing and productivity.

My question is how have people implemented different types of users in
their Web applications?

As for my application, I use single table inheritance in order to derive
several different types of users, such as “moderators,” “editors,” etc

For example, let’s say that I want to create a moderator. I define a new
moderator class and Controller like so:

class Moderator < User

class ModeratorController < UserController

My problem with this is that since several functions such as “login,”
“signup” and others directly call the User class. I cannot simply
inherit the ModeratorController from UserController without overriding
everyone of these functions and changing every instance of “User” with

I think there must be a simple and elegant solution to this. Any

Hi Daniel -

See my reply on the Rails list to this.


  • james

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs