Forum: Ruby on Rails are serialized fields required?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
9dd5f2bc9a1a32a86db6e68f1f1907d4?d=identicon&s=25 (Guest)
on 2007-01-23 22:38
(Received via mailing list)
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 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?

9dd5f2bc9a1a32a86db6e68f1f1907d4?d=identicon&s=25 (Guest)
on 2007-01-24 19:33
(Received via mailing list)
Well I haven't gotten a reply, but I did find this relevant patch,
which was submitted a few days ago:

This topic is locked and can not be replied to.