I am working on a ruby on rails application with many types of users. All users will share the basic properties of email address and password, along with the timestamp fields for created_at and updated_at. Other fields will be unique to the type of user (think Employee, Vendor, Manager, etc.) I have been looking into Single-Table Inheritance but that does not seem like the right pattern for this. The other option seems to be to have a User model that has_one of the other models. It is also possible for a User to have multiple types, ie. Employee and Manager could be the same User. I also want to direct the user to a specific page on login, based on what type of user they are. Would this be best done through constraints in the router or a large switch statement on login?
Share
You probably need to define user roles. I suggest CanCan to manage your roles and access privileges.
One way to to implement different fields on a single table would be to use NoSQL (hstore) from Postgres. This is a simple introductory tutorial.
Here is and example of using it with Rails 3.2+