I have a hash with ActiveRecord objects in them that I am marshaling and
storing as a constant in my migration files–so I can store additional
information needed while I do migrations. I am able to do migrations
just fine, which tells me that adding the constant (which is equal to
them marshaled hash) to the migrate class doesn’t cause any problems.
However, when I try to do a Marshal.load(MigrateClass::HASH_OBJ) I get
the following error:
undefined class/module MyActiveRecordClassName
…where MyActiveRecordClassName is the first ActiveRecord reference
made in the marshaled hash. I know that objects that “include bindings,
procedure or method objects, instances of class IO, or singleton
objects” (see ruby docs) cannot be marshaled. Do ActiveRecord objects
include any of these? Can ActiveRecord objects be marshaled?