From: Jamey Cribbs Date: 2006-07-28T11:26:51+09:00 Subject: Re: Mongoose 0.2.5 - The "Two Steps Forward, One Step Back" release GFunk913@gmail.com wrote: > # Create new table. Notice how you specify whether a column is indexed > or not. > db.create_table(:thing) do |tbl| > tbl.add_column(:foo,:dunno_what_to_put) > end > > # Add a record. You can also use #create. > rec = Thing.new > rec.foo = (1..100).to_a > rec.save > > puts Thing.find.first.foo.size #100 > > Logan already gave you one way to do this, and, probably from a purely relational perspective, his suggestion is the right way to do it. Additionally, I know that ActiveRecord has the serialize class method that you can use to have the object specified Marshaled into and out of the db. I am thinking of supporting that method, just because I want to stay close to ActiveRecord's api. The funny thing is, Mongoose *already* Marhsals all of the data (that's how it stores the table records). Right now, I don't think I am doing much data checking in the #save method, so you could probably get away with declaring the data type as :string and then just going ahead and saving the array to rec.foo like you are doing in the example. It should work. Of course, in an upcoming version, I will make all of this work the way it should, i.e. do more data type checking in #save and also give you the ability to specify which columns you want to serialize. HTH, Jamey