Forum: Ruby on Rails Multiple User Types - Michael Hartl's Tutorial

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.
C49078569b6ca169ccfa3481f7bcdaee?d=identicon&s=25 Erdem Gezer (Guest)
on 2012-11-17 01:17
(Received via mailing list)
Hi all,

Can I have your opinions about the implementation of multiple user types
that can login and play in different roles?

What do you think about the answer on stack overflow?
http://stackoverflow.com/questions/10876059/michae...

Thanks,
Erdem
5f94b9b346c2aa648a80bc259978e5bc?d=identicon&s=25 Colin Law (Guest)
on 2012-11-17 08:59
(Received via mailing list)
On 17 November 2012 00:15, Erdem Gezer <erdemgezer@gmail.com> wrote:
> Hi all,
>
> Can I have your opinions about the implementation of multiple user types
> that can login and play in different roles?
>
> What do you think about the answer on stack overflow?
>
http://stackoverflow.com/questions/10876059/michae...

I would first question the basic premise of multiple user types.  Is
that really necessary?  Can a user every be of both types?  Perhaps
the requirement is not for different types of users but for users with
different roles, meaning that a user can perform the role of a
publisher or a subscriber (in the example given) or perhaps even both.
 In which case the requirement is just for a single user table with
something like cancan to provide roles.

Colin
C49078569b6ca169ccfa3481f7bcdaee?d=identicon&s=25 Erdem Gezer (Guest)
on 2012-11-17 14:51
(Received via mailing list)
Hi Colin,

Thanks for your reply.
Actually I don't want each user to have multiple types. Only 1 type per
user is ok for me.
I can satisfy that by using polymorphic relations. I have 1 db table for
common user attributes(email,name,password) and 2 more tables for the 2
user types(admin,manager)

But I'm confused while implementing the SessionController.
Each user type will have different login and register forms.
Do you think using a single SessionController for the login/logout
operations for both user types is fine (with different session keys)?


Thanks,
Erdem
This topic is locked and can not be replied to.