Saving an array

Alternatively, you could specify the column to be a serialized Array on your model. For example:

class Model < ActiveRecord::Base   serialize :coordinates, Array end

Model.create(:coordinates => [[1,2],[3,4]])

...

Model.find(:first, :order => 'id DESC').coordinates

=> [[1,2],[3,4]]

In your database, you'll need to specify 'coordinates' as :text or :string (the former preferred if you have lots of data).