Updating multiple attributes


#1

I have a store administration tool I’m trying to build.

One view is an item view. Each item can have many attributes.
Example:
item: bike
item_id: 2333
attribute: id: 3 #auto-increment
item_id: 2333 #primary key
attribute_type: wheels #a type of attribute
attribute_order: 1 #the order it shows up in the
list
attribute: id: 4 #auto-increment
item_id: 2333 #primary key
attribute_type: wheels #a type of attribute
attribute_order: 2 #the order it shows up in the
list
attribute: id: 6 #auto-increment
item_id: 2333 #primary key
attribute_type: colors #a type of attribute
attribute_order: 1 #the order it shows up in the
list

This bike may have many wheel attributes, many color attributes, etc.

What I’d like to do is be able to have a view that displays both the
item level information, and all of the attributes of that item so I can
edit them all on one page.

I’m not sure how the name of the input tag would be structured.

ex:

But how do I specify which one of the attributes?

And then how would I update the entire list of attributes in the
controller?
@item.update_attributes(params[XYZ])
?

Thanks for your help!

Dave


#2

David C. wrote:

I have a store administration tool I’m trying to build.

Solved my own problem… thx

This helped a bunch.

http://jgchristopher.blogspot.com/2005/09/ruby-on-rails-editing-multiple-rows-of.html