I'm working on a project in which Accounts belong to a User.

I'd like the User's Welcome page to show who else has the same Accounts
(based on account name) as that user.

What I tried to do was place a SQL query inside a for loop, such that
the loop would go through the session User's accounts and check, in
turn, for all similarly named accounts in the Accounts table.

I think that there must be something wrong with my code; right now,
it's as follows:

	<table>
	<%@session['user'].accounts.each do |i| %>
	<%Accounts.find(:all, conditions = ["coursename LIKE ?",
"%#{i.coursename}%"])%>
	<tr>
	<td><%= account.name %></td>
	<td><%= account.number %></td>
	<td><%= account.user_id%></td>
	</tr>
	</table>
	<%end%>

	<% end %>


I'm new to Ruby, so I think syntax is the most likely culprit here.

Thoughts?


Thanks a lot,

   - Raffi.