so i have a serialized column :dimensions, and in my migration, i would like to set the field to be a default hash.
i have tried...
create_table :shippin
I tried this code and it worked for me. This takes advantage of the way ActiveRecord sends model methods synced to table columns dynamically.
class MyModel < ActiveRecord::Base def dimensions_in attributes["dimensions_in"] ||= {:width => 0, :height => 0, :depth => 0} end end