Text_field_with_auto_complete

I am using the auto_complete functionality

<%= text_field_with_auto_complete :category, :name … %>

after the user select an item , I need to get the ID of the selected
item (category[:id]), is there any way to do it ? so I could give a
value to a hidden field in my form, using the :after_update
OR
should I get it later with a Category.find_by_name (which will add
another DB request…)

thanks for your suggestions

kad

On Mon, May 19, 2008 at 7:13 PM, Kad K.
[email protected] wrote:

I am using the auto_complete functionality

<%= text_field_with_auto_complete :category, :name … %>

after the user select an item , I need to get the ID of the selected
item (category[:id]), is there any way to do it ? so I could give a
value to a hidden field in my form, using the :after_update
OR
should I get it later with a Category.find_by_name (which will add
another DB request…)

Have a look at model_auto_completer:

http://agilewebdevelopment.com/plugins/model_auto_completer