Hi,

I=92m a real newbie to ruby, but I have a bit of a background in php/mysql.=
  I=92ve been assigned work on a low profile, low priority project to help =
me learn.   So a lot of the tables are already defined and I probably shoul=
dn=92t change them at this stage.

I have a table of users:
Name, loginname, department_number(and more) =96 this is already modeled an=
d working in the app

I have a table of departments
department_admin_loginname, department_number(and more)  -  this is an exis=
ting table in a different database on the same ms sql server.  It is not a =
part of the app and is used by several other apps, so I really can=92t alte=
r it.

Departments can have more than one admin, and a user can be an admin of mor=
e than one department.  A user may belong to multiple departments, thus hav=
ing multiple department admins.  I don=92t care what department you are in.

All I need to know is when a user logs in, is the user an admin and who are=
 people he or she is an admin for.   If the user is not an admin, show who =
your admins are.

My first instinct was to create a view that joined up a few tables in a cou=
ple of different databasesd order to produce a lookup table:
admin_loginname, user_loginname

When a user logs in, fire two quick queries:  select user_loginname from jo=
intable where admin_loginname=3D=91myname=92 and select admin_loginname fro=
m jointable where user_loginname=3D=91byname=92.  Bada-boom, bada-bing 4 li=
nes of php and I=92ve got your info ready to go.  But I know how ruby peopl=
e feel about php. ;)

I think I understand how I would use has_many and belongs to if I were conn=
ecting 2 different modeled objects.  Customers and Orders come up a lot in =
the examples.  But in this case, a user can be associated with many users b=
ased on that lookup table.  The lookup table isn=92t really a class that sh=
ould be modeled, neither are any of the tables in the join to produce the v=
iew.

Any ideas or pointers to examples?

Thanks!