Getting a record id from text_field_with_auto_complete
Posted by Jim Morris on 2006-10-23 13:58:46 +0000
I ran into this problem a few times,and I have seen others asking the
same question, if you use text_field_with_auto_complete and the
selection list returns non-unique results, how do you reference the
actual record in the database you want?
For instance if you have text_field_with_auto_complete :customer, :name
then in your controller: name= params[:customer][:name] and
Customer.find_all_by_name(name) returns more than one entry you need
to be a little more tricky to retrieve the actual record you wanted to
select.