Topic: Use two models to make a list?

I have two tables in my database.  One is Companies and the other is Cities.  Each company has one city.

On the main page I want to list out company.name - company.address, city.name (and make the entire thing one link, if someone can help with that too)

So I was just kinda guessing at this, but can't figure out the answer.  Anyway here's the wrong way.
company_controller:

  def list
    @page_title = "Companies"
    @company_pages, @companies = paginate :companies, :per_page => 10
    @company = Company.find(params[:id])
    @city  = City.find(@company.city_id)
  end

and part of the list.rhtml:
<% for company in @companies %>
  <tr>
    <td><%=h @company.name %> - <%=h @company.address %>, <%=h @city.name %></td>

Thanks as always

Re: Use two models to make a list?

Try this:

# controller
  def list
    @page_title = "Companies"
    @company_pages, @companies = paginate :companies, :per_page => 10
  end
# view
<% for company in @companies %>
  <%=h company.name %> <%=h company.city.name %>
<% end %>

Here we are simply referencing the city through the company.

Railscasts - Free Ruby on Rails Screencasts