Legacy Single Table Inheritance - Specify Discriminator?

I have a legacy database that was designed to work with Hibernate. I
have the following class hierachry:

class Status < ActiveRecord::Base
class ItemStatus < Status
set_inheritance_column :item_type
class MediaItemStatus < Status
set_inheritance_column :item_type

My issue is that the discriminator used in Hibernate was the string
literal “MEDIA” for a MediaItemStatus and “ITEM” for an ItemStatus. I’m
new to rails and I’m not finding a way to specify what AR should expect
for actual discriminator values. Is this possible in Rails 2.3?

On Oct 2, 2:57 am, Steve S. [email protected] wrote:

My issue is that the discriminator used in Hibernate was the string
literal “MEDIA” for a MediaItemStatus and “ITEM” for an ItemStatus. I’m
new to rails and I’m not finding a way to specify what AR should expect
for actual discriminator values. Is this possible in Rails 2.3?

You could try overriding Status.compute_type

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs