On Apr 14, 10:27 pm, comopasta Gr
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Hi,
>
> My users can select items and define a quantity attribute for those.
> Those items can be selected with checkboxes. And the quantity is a field
> text.
>
> Collecting all in one form; the checkbox selections, and other details,
> the info should be stored in the db. Resulting in a purchase order for
> example. A single user wouldn''t have many purchase orders in the
system
> at one time.
>
> My question is how to store the resulting array in the db? I know how to
> get the array of values but what should I use as the container in the
> db, a single row with a sting hash, store each item separately,
> something else? How can I relate the quantity for each item?
>
Just off the top of my head, i''d think you''d want your
purchase order
class to has_many :items through :some_join_model. The quantity would
be stored on the join model.
Fred
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
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
-~----------~----~----~----~------~----~------~--~---