Thanks, Thomas. I didn’t know about the additional switches on the relationships. Now that I have the relationship formed I still don’t understand what I need to use to extract it from the joined tables. Here is a better idea of what I have:
User Model
has_many :task, :through => :task_owner
has_many :task_owner
Task Owner Model
belongs_to :task
belongs_to :user
Task Model:
has_many :task_owner, dependent: :destroy
So that should take care of my relationships in the models. So I created a Home controller with the following code:
def index
@mytasks = TaskOwner.where( :user_id => session[:user_id] )
end
And on the index page I loop the results:
<% @mytasks.each do | mytasks | %>
<%= mytasks.task_id %>
<% end %>
The output will show me the task_id of the tasks belonging to the user that is logged in, but if I change it to something like mytasks.title I get the following error:
undefined method `title' for #<TaskOwner:0xb28011c>
So I guess I don’t understand how display the contents still.
Thanks,
Brian