When I specify that a field is serialized in the model, but create an
object of that model without the (optional) serialized field, I run
into problems that seem to indicate serialized fields are required. It
seems to be taking the nil value of the field and trying to unserialize
it, unsuccessfully.
So, in my model:
class Person < ActiveRecord::Base
serialize :research_discipline, Array
When I do this:
member = Member.new # Member subclasses Person
assert !member.valid?
I get:
ActiveRecord::SerializationTypeMismatch: research_discipline was
supposed to be a Array, but was a NilClass
So can I have an optional serialized field?
Thanks,
Julia