Finding Associated Records

I am trying to find all associated tickets with an employee. I am very
new to HABTM so I am having some trouble.

view: time.html.erb

<h1>Time Report for <%= @employee.name %></h1>

<table cellpading="10" cellspacing="10" style="width:700px">
  <thead>
    <tr>
      <th>Job #</th>
      <th>Company</th>
      <th>Project</th>
      <th></td>
    </tr>
  </thead>
  <tbody>
  <% for ticket in @employee %>
    <tr class="<%= cycle('odd', 'even') %>">
      <td>
        <%= @employee.ticket.id %>
      </td>
    </tr>
  <% end %>
</table>

Controller:

  def time
    @employee = Employee.find(params[:id], :include => { :tickets =>
:workorder} )
  end

Employee Model:

class Employee < ActiveRecord::Base
  has_and_belongs_to_many :tickets

  validates_uniqueness_of :name
end

Ticket Model

class Ticket < ActiveRecord::Base
  has_and_belongs_to_many :employees
  belongs_to :workorder
end

Error

 NoMethodError in Employees#time

Showing employees/time.html.erb where line #13 raised:

undefined method `each' for #<Employee:0x326b044>

One problem is here:

<% for ticket in @employee %>

<% end %>

You need:

<% for ticket in @employee.tickets %>

<% end %>

OR

<% @employee.tickets.each do |ticket| %>

<% end %>

Secondly, make sure you have a join table when doing a habtm
relationship.