# How to edit many-to-many -- rhtml setup?

**URL:** <https://www.ruby-forum.com/t/how-to-edit-many-to-many-rhtml-setup/119087>\
**Category:** Rails\
**Created:** [November 2, 2007, 11:43pm UTC](https://www.ruby-forum.com/t/how-to-edit-many-to-many-rhtml-setup/119087 "2007-11-02T23:43:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![olie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/c4cdca/32.png) [@olie](https://www.ruby-forum.com/u/olie)\
**Post date:** [November 2, 2007, 11:43pm UTC](https://www.ruby-forum.com/t/how-to-edit-many-to-many-rhtml-setup/119087/1 "2007-11-02T23:43:19Z")

</div>

I’ve got two tables: “colors” has a color and id column and rows “red”,  
“green”, blue". “cars” has maker and id columns and rows for “ford”,  
“chevy”, “dodge”. I’ve got a 3rd table, inventory. It’s got columns  
for car\_id, color\_id and qty. So I’d like to display a table on screen  
that looks something like this:

```
         red green blue

```

ford 17 12 3  
chevy 9 21 11  
dodge 19 1 8

(Bah! This will look like hell in whatever different-font you’re  
reading in. Just squint and use your imagination… 🙂

Ok, this much I can do, fairly easily. The part I’m having trouble with  
is: I want the qty numbers to be editable text fields, and the whole  
thing to have a single save button/link at the bottom. My user-case is  
to allow a person to change any or all of the values, press SAVE and  
have the table update correctly, which involves writing out many changed  
rows.

For bonus points, it’d be cool not to update the rows that didn’t  
change.

Are there good examples or tutorials to help show me what fancy-pants  
rails tricks I want to use?

Thanks!
