开发者

Ruby on Rails: How can I authenticate different user types from one place?

This is my first post on Stack Overflow. I am trying to build a system that authenticates three types of user with completely different site experiences: Customers, Employers, and Vendors.

I'm thinking of using a polymorphic 'User' table (using AuthLogic) with username, password, and user_type (+ AuthLogic's other required fields). If this is a good way to go, how do I set this up so after authenticating an开发者_开发知识库 user_id with a user_type the standard way, I can direct the user to the page that's right for them?

Thanks.


I'd consider STI in this case. Then each can authenticate as a normal user, but easily branch into their own specific behavior when needed. You may need to do some work with your routes to make everything line up, however.


sscirrus, are there any relationships between them (Customers, Employers, and Vendors) at all? I've got a similar case but with a one-to-many relationship.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜