Re: RESTful Authentication and dual login

Roger Pack
2008-05-05T04:48:09Z

My gut instinct is it''d be easier to have one user table.
-R

On Sun, May 4, 2008 at 8:05 AM, Costo
<laurent.cortier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
>
>  Hello all,
>
>  I''m setting up a RIA with 2 separate "sub sites" (with
namespaces in
>  the routes), let''s say one for the clients, the other for the
>  dealers.
>  I want to use RESTful authentication, have followed the nice tutorial
>  available here (http://railsforum.com/viewtopic.php?id=14216&p=1) and
>  it works perfectly, but it is not adapted to my dual login system, and
>  I''m really scratching my head to modify this. I come from a
C++/PHP
>  background, so I''m still finding my marks around models, filters,
REST
>  routes (ressources), etc.
>
>  So should I keep :
>  - one "users" model, with 2 :has_one relationships (1 to clients
>  model, 1 to dealers model, of course mutually exclusive) and a boolean
>  in the users model to indicate if it''s a client or a dealer ;
>  - or no users model but two totally separate and complete models
>  ("clients" and "dealers"), with all user information
in each, and only
>  1 stored in the session, but then how could I know which one ? and
>  that means no more current_user in the session but rather a
>  current_client OR current_dealer ?
>
>  Help, I''m really stuck on that one, I can''t decide the
most natural
>  (and most DRY) method of applying my "simple" business rule in a
rails
>  2.0 environment.
>
>  Laurent Cortier.
>  >
>