conditional association

AD
Sun, 27 Jan 2008 03:58:50 -0000

hello ,
 i have an association as follows.  A user is of type "author" or
"reader".
 In the user table is a column called user_type_id that references a
user_type table of 2 records, author, reader.  What i am trying to do is the
following:

 Create an association such that a user has_one :profile, but the :profile
is either author_profile table or reader_profile table (they have too many
different attributes to make one profile table) depending on the user type.
 is there a way to specify a conditional has_one in the user model that
would allow access to ''user.profile'' but know which model to
reference ?
 Either that or do a conditional set_table_name depending on a variable ..

Any help here appreciated.

Thanks
Adam