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!