# Autocomplete and database updates

**URL:** <https://www.ruby-forum.com/t/autocomplete-and-database-updates/195602>\
**Category:** Rails\
**Created:** [September 26, 2010, 6:18pm UTC](https://www.ruby-forum.com/t/autocomplete-and-database-updates/195602 "2010-09-26T18:18:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![brian](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/97f17d/32.png) [@brian](https://www.ruby-forum.com/u/brian)\
**Post date:** [September 26, 2010, 6:18pm UTC](https://www.ruby-forum.com/t/autocomplete-and-database-updates/195602/1 "2010-09-26T18:18:48Z")

</div>

I’m trying to figure out a way to have the rails3-auto-complete plugin  
pull back a Name field in the text box but when saving to the database,  
that it would only save a hidden id field and not the name (for database  
normalization purposes). Here is my example

Category  
id  
name

Item  
id  
name  
description  
category\_id

When I do the text field for autocomplete

I would only want the hidden value submitted and I don’t know what a  
good approach or recommendation woudl be. I could denormalize the  
database but I don’t want too and I could also put some of these  
categories into just a standard file and read from them…but would like  
to learn how to do this properly within Rails.
