Saving multiple select form data in db

Posted by fl00r on Stack Overflow See other posts from Stack Overflow or by fl00r
Published on 2010-05-08T19:40:34Z Indexed on 2010/05/08 19:48 UTC
Read the original article Hit count: 183

Hi.

I've got form for some model A, which has got few fields:

  • tile
  • description
  • ...
  • colors

colors are selected from multiple select and options are ['red', 'green', 'blue', 'yellow']. User can choose colors as many as he wants. I don't think that making Color model and has_many relationship is good solution here to store colors data in model A. So question is:

How to store multiple data in db for such multiple select forms?

© Stack Overflow or respective owner

Related posts about serializing

Related posts about ruby-on-rails