Forum: Ruby on Rails updating multiple attributes

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2da252cc1d2fb3701126171831b50a65?d=identicon&s=25 Dave Coleman (pezdude)
on 2006-03-22 03:53
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: <input type="text" name="item_item_attribute_attribute_typeXYZ">

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
2da252cc1d2fb3701126171831b50a65?d=identicon&s=25 Dave Coleman (pezdude)
on 2006-03-22 05:10
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-...
This topic is locked and can not be replied to.