[Rails] autocomplete and database updates
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
<input type="text" name="item[category]" value="TestValue" />
<input type="hidden" name="category_id" value="2" />
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.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home