I have a problem with serialization. In my model I have
class PramEntry < ActiveRecord::Base
serialize :pram_units_array, Array
attr_accessible :pram_units_array
end
then I do
entry = PramEntry.new
entry.pram_units_array = [PramUnit.new(depth: 1, width: 1)]
entry.pram_units_array
=> [#<PramUnit:0x007fb368eb8ae8 @depth=1, @width=1>]
entry.save
=> true
but then I load this object from database
entry = PramEntry.first
entry.pram_units_array
=> "---\n- &70364639756800 !ruby/object:PramUnit\n depth: 1\n width: 1\n errors: !ruby/object:ActiveModel::Errors\n base: *70364639756800\n messages: !omap []\n validation_context: \n"
it doesn't serializes it back from yaml. What I am doing wrong? Thanks in advance!