multiple_table_inheritance
multiple_table_inheritance copied to clipboard
Problem loading object when Rails identity map is active
I have two AR models: Offer and TranslationOffer, the latter "inheriting" from the former. The first time I fetch an Offer, the correct object is returned:
> Offer.find 1
=> #<TranslationOffer offer_id: 1>
But in case Rails' identity map is active, if I run the same line again, I get the parent object instead:
> Offer.find 1
=> #<Offer id: 1>
Of course a simple workaround is to disable the identity map, but there should be a less definitive way to deal with it. Isn't it possible to disable automatically the identity map for active record models that act as superclass?