autocomplete for

I have this code in my view:

<%= text_field_with_auto_complete :client, :name %>

when I submit new, y get:
    "client"=>{"name"=>"MSO"}

I want to get:
    "repair_ticket"=>{"client_id"=>"??"}

My models are

class Client < ActiveRecord::Base
  has_many :repair_tickets
end

class RepairTicket < ActiveRecord::Base
  belongs_to :client
end

How can I do that?

I'm not sure what you're asking but here goes.

They submit :client => {:name => 'john'}

you do

client = Client.find(:first, :include => [:repair_tickets] :conditions
=> ['name = ?', params[:client][:name]])
client.repair_tickets => what you want?

John Smith wrote:

I have this code in my view:

<%= text_field_with_auto_complete :client, :name %>

when I submit new, y get:
    "client"=>{"name"=>"MSO"}

I want to get:
    "repair_ticket"=>{"client_id"=>"??"}

A bit of a hack, but you could do somthing like this before you save:

@repair_ticket.client_id = params['form_field']['name']