Reputation: 21
I'm new in rails. I read rencently how to serialize an array of string for example to store it in database.
class Fle < ActiveRecord::Base
serialze :etat_fle
end
But i don't know how to represent this serialized field in the corresponding ActiveRecord::Migration Have someone an idea ?
Upvotes: 1
Views: 63
Reputation: 21
As Major Major said, i have to declare the field like this in my migration file
t.column :type_fle, :text
and additionnaly i have to declare the field prefixed by the word serialize in my ActiveRecord::Base file
serialize :type_fle
Upvotes: 1
Reputation: 3293
Store it as a text
. If the table is already created -
add_column :table, :column, :text
Upvotes: 2