need help with (simple?) find statement

I have a basic enrollment system where a user can enroll in a course either as a student or instructor.

users(login) enrollments(user_id, course_id, type_user_id) courses(title) type_users(title) where title is 'instructor' or 'student'

I need to list all the courses for which a user is the instructor so I wrote this

user.courses.find(:all, :include => {:enrollments => :type_user},                           :conditions => "type_users.title = 'instructor'")

What this is returning, however, is all the courses the user is enrolled in that has an instructor. Thanks for any help!

vince wrote:

I have a basic enrollment system where a user can enroll in a course either as a student or instructor.

users(login) enrollments(user_id, course_id, type_user_id) courses(title) type_users(title) where title is 'instructor' or 'student'

I need to list all the courses for which a user is the instructor so I wrote this

user.courses.find(:all, :include => {:enrollments => :type_user},                           :conditions => "type_users.title = 'instructor'")

What this is returning, however, is all the courses the user is enrolled in that has an instructor. Thanks for any help!

What does your SELECT statement look like?