I've run into this situation - recently had a client that stated
during the
initial development that 'Users can only ever have one role'. So I
used
STI for all the user types; in addition to permission differences,
each
role had different associations and sitewide navigation.

THEN, the client says, "Well, some people can be more than one
thing"...

I ended up using a hackish solution where users get stored with their
role
as part of their email; ie a user with multiple roles would have two
records in
the DB:

- [email protected]
- [email protected]

Then the login screen and the user models were tweaked so that
[email protected]
has a consistent set of profile details and password hash/salt, and
could log in
as just [email protected].

Finally, I added a role select screen so that, in this example, bob
could switch between
admin and candidate.

I'm not suggesting that this is the best solution, merely a possible
one. It was good
for my app because the different user types see totally different
navigation structures.

--Matt Jones


On Feb 20, 12:13 pm, Mrkris Mrkris <[email protected]>
wrote:
> Dave S wrote:
> > I've used restful_authentication and role_requirement for a similar
> > situation. It's easy to setup, and should allow you to do all the
> > stuff you want. As far as the associations you speak of, you probably
> > to setup some different find methods with_scope. Check out the
> > following links for more info...
>
> >http://github.com/timcharper/role_requirement
> >http://github.com/technoweenie/restful-authentication
> >http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M002256
>
> > On Feb 20, 1:02 am, Mrkris Mrkris <[email protected]>
>
> Yeah, I love role_requirement, been using it for a while. I guess I'll
> just stick with it instead of STI.
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to