How to add default array to column in db

127 Views Asked by At

Now i am trying add default value to database column. I am trying with the following migration file.

def change
  add_column :user_preferences, :preference, :default => "Media, Responsibilities, Email"
end

When i am trying to rake db:migrate it show the following error.

undefined method `to_sym' for #<Hash:0x007fc33683e658>/db/migrate/20141120090990_add_preference_to_user_preference.rb:3:in `change'
NoMethodError: undefined method `to_sym' for #<Hash:0x007fc33683e658>
/db/migrate/20141120090990_add_preference_to_user_preference.rb:3:in `change'

In model

serialize :preference

I want to add default to that preference column. Help me.

0

There are 0 best solutions below