displaying foreign key value

Hi

i have a has_many app. Imagine Projects <> Tasks.
Creating a new tasks i can select from the dropdown the desired Project.
that works. Editing the taks , which means changing the project
association again via dropdown works as well. BUT and thats the
question:
how do i display the project name in the tska/show view?
  <b>Task:</b>
  <%=h @task.title %>
  <b>Task-Desc:</b>
  <%=h @task.desc %>
  <b>Project:</b>
  <%=h @Project.title %> ???
OR
  <%=h render :text => Project.find_by_id(@task.project_id) %>

HOW is ths working?

thx tom

<%=h @Project.title %> ???

OR

<%=h render :text => Project.find_by_id(@task.project_id) %>

HOW is ths working?

if in your Task model, you have

belongs_to :project

then in your view

@task.project.title

thx, i totally oversaw the missing relations...