Forum: Rails Engines single table inheritance for different user types?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Eed898c43511083cdd44aff94071a419?d=identicon&s=25 Daniel Holmlund (Guest)
on 2006-01-11 18:35
First of all, I wanted to give a harty "thank you" to James Adams 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
end

class ModeratorController < UserController
end

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
"Moderator"

I think there must be a simple and elegant solution to this.  Any
suggestions?
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 James Adam (Guest)
on 2006-01-11 22:09
(Received via mailing list)
Hi Daniel -

See my reply on the Rails list to this.

Cheers

- james
This topic is locked and can not be replied to.