Thursday, April 25, 2013

How to store array in mysql database in a Rails project


1. The column type should be text
2. serialize the column. In the active record class : serialize :your_field
3. Book.new(:your_field => [1,2])