Problem with menu functionality

Hi, I’m trying to display separate menus based on records in database
tables. The menus are situated within a form which separates the menus
based on their service type. The ‘service’ table references the
costcenter_id so each service is either in category X or Y. Each menu is
supposed to list all of the items in X or Y. Since there are only two
records (X and Y) in the ‘costcenter’ table, only two menus should show
up. The menus show up fine and are populated with the items correctly,
but he problem is that the first menu works fine, but the second menu
does nothing at all when I submit the form.
Whenever I select an item in the second menu, what shows is the same
error as if I had selected no data in the form and tried to submit it. I
always see this error:

" NoMethodError in ConsultsController#create

You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.charge_rate"

Why would the first menu be able to see @var.charge_rate but not the

In the view:

<% @costcenters.each_with_index do |costcenter, index| %>

<%= %>

> <% @services.each do |service| %> <% if != 0 %> <% if service.costcenter_id == %> <%= %> selected <% end %> value="<%= %>"> <%= %> <% end %> <% end %> <% end %>
<% end %>

In the controller:

def create

#the next 3 lines will get the charge rate
serv_id = @consult.service_id
@service = Service.find(:first, :conditions => [“id = ?”, serv_id])
@consult.charge_rate = @service.charge_rate
@consult.total_charge = Consult.totalCharge(@minutes,
flash[:notice] = ‘Consult was successfully created.’
redirect_to :action => ‘list’
render :action => ‘new’