I have an active record class with an embedded sample:
class LabResults < ActiveRecord::Base
serialize :sample
end
class Sample
attr_accessor :values # GSL::Vector of responses
def to_yaml
YAML.quick_emit( self, opts ) { |out|
out.map( "!testfile,2012-02-27" ) { |map|
@values.map{|v| v.to_a }
}
}
end
def analyze; end; # do stuff with values
end
I want to serialize and store sample in the database, but GSL::Vector (from gsl gem), does not have a to_yaml method. Defining to_yaml and YAML.quick_emit for Sample is apparently deprecated when using Rails 3.2's default YAML engine Psych.
Any ideas how to serialize and de-serialize this object?