How to fetch a field through few tables.

Hi, I have the following situation, 3 tables as follows:

TableA: TableB: TableC:
------- ------- -------
TableB_ID User_ID User_ID

TableB_ID is a foreign key to TableB, User_ID in TableB and TableC is
foreign key to a table that play no role hier.

now I would like to display the User_Name field found in TableC in a e.g
index view. So I need to go from TableA with the TableB_ID foreign key
to get the User_ID field from TableB, then search for the record in
TableC that has this User_ID as one of its fields and get the User_Name.

This should look something like:

<td><%= TableA.TableB.TableC(where TableB.User_ID ==
        TableC.User_ID).User_Name %></td>

I know that the syntax above is not correct but just to show what I'm
looking for.

Hope I made my self clear :wink:


<td><%= unless
course_attendee.sys_title.nil? %></td>

Do you have these set up as models in your application?

Perhaps you should take a look at the Rails Guides, specifically the ones on Models

It might even be better to start with the one on ActiveRecord Associations