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.