Newbie - list based on joined query?


#1

I’m retrieving a list of tasks to display in a page using

@delegatedtask_pages, @delegatedtasks = paginate :tasks, :conditions =>
“user_id = " + session[:user_id].to_s + " percent_complete <> 100”,
:order_by => ‘due_on asc’

I’d like to only list the tasks which have been assigned to other
people. I have a table called assigned_tasks which links my tasks to the
users. A straight SQL query to accomplish this might be

SELECT * FROM tasks INNER JOIN assigned_tasks ON tasks.id =
assigned_tasks.task_id WHERE tasks.user_id = x AND
assigned_tasks.user_id <> x

How do I accomplish this with rails?