Rails will store the name of a child class in the database
to use for re-instantiating the record as the correct class later.
By specifying an `inheritance_serializer` and
`inheritance_deserializer`, you can customize the stored identifier.
class Foo < ActiveRecord::Base
self.inheritance_serializer = ->(klass) do
# Map the class to the appropriate type identifier.
# Defaults to `klass.name`.
self.inheritance_deserializer = ->(type_before_cast) do
# Map the type identifier back into the appropriate class.
# Defaults (approximately) to `type_before_cast.constantize`.
This is primarily useful for working with legacy data models.