Invalid single-table inheritance

Using Forest Admin along with Rails and STI, reload breaks everything.
When the Rails cache is deactivated for development purposes, declared STI systematically down the response.

Console issue:

Forest 🌳🌳🌳  Records Index error: Invalid single-table inheritance type: XXX is not a subclass of YYY

Where XXX extends YYY, and YYY extends ActiveRecord::Base

A repository reproducing the error is available here: GitHub - off-works/forest-sti. Just follow instructions.


Hi @Off-Works , and welcome to our community :wave:

Really nice reproducible example. I just followed your and I’m able to reproduce this issue. I’ll investigate this to see if I’m able to locate the origin of the issue.

Many thanks :pray:


HI @jeffladiray,

Did you had enough time to reproduce the problem and target the source ? Don’t hesitate to ask if you need complementary informations.

Thanks for your help :slightly_smiling_face:

Hi @Off-Works,

Thanks for your message!

The issue is still under investigation.
Here are some details to follow the resolution.

Thanks again for your patience :slight_smile:

1 Like

Hi @adriguy ,

There’s almost a month, we posted this problem with an associated repository. It’s quite blocking on our side …

Could you up the topic and reconsider it as soon as possible ?

Many thanks :wink:

Hello @Off-Works,

Looks like this is a known issue with hot reload in dev environment and STI.
Would will be possible for you to activate the cache?

config/environments/development.rb line 9

config.cache_classes = true

Let me know if it solves your issue :slight_smile:


We’ve already known since the beginning that this error is relative to cache_classes parameter.
I’ve mentioned it in my first message:

When the Rails cache is deactivated for development purposes, …

Unfortunately, we just can’t disable this parameter on environment development, it is too important. :frowning_face:
It is not really a workaround to have to restart the web server each time we make code changes, just to make ForestAdmin work.

Why ForestAdmin gem doesn’t work correctly with STI classes when cache_classe is disabled? It’s clearly a big issue.

Hi @Off-Works,

Thanks for your help, the issue is well identified.

Unfortunately we don’t have the bandwidth to fix this issue in the short term.
We plan to recruit people to help us solve those kind of complex issues.

I am sorry to inform you that you’ll have to activate the cache while developing for ForestAdmin purpose if you want to have a properly working STI. Although painful, it is a valid workaround for the issue.

If this is too painful for you, another option is to fork the open-source gem and find a way to solve this issue.

Thanks for your patience.