Topic: Displaying Data with Foreign Keys

I am creating a task management web app and I have hit a snag I can't figure out. I have created two tables one that contains user data (email, name, etc ..) and a second that contains task data (title, due date, etc ...). What I have done was on task create I write to a third table that stores the user_id and task_id to assign the user to a task.

I think I have the relationships correct on it, because I have it set up when the task is destroyed it is also removed from the third table as well.

What I can't figure out is how to display the task record for the user that it is assigned to. I am trying to call this from a home controller, but I'm not sure if this is bad design or bad syntax. All that I can successfully display is the task_id for that specific user. How do I show the record instead?


This is my first project outside of a tutorial and I can't figure this one out. Any help would be greatly appreciated.

class HomeController < ApplicationController
  def index
    @mytasks = TaskOwner.where( :user_id => session[:user_id] )
  end
end