Inherited Ruby model setup leads leads to table not found

Hi community,

Recently, I’ve got a problem with our setup of ForestAdmin.
When trying to edit anything on some kind of model, I’ve got an error:

Model XXX update failed: ERROR: relation “SuperClass” does not exist LINE 8: WHERE a.attrelid = ‘“super_class”’::regclass ^

I’ve checked all my logs, and it seems that the errors comes directly when Forest tries to communicate with our database.

Could you help me?

Expected behavior

I should be able to update any column on model XXX

Actual behavior

Whatever data I try to change on model XXX, I got the following error:

Model XXX update failed: ERROR: relation “SuperClass” does not exist LINE 8: WHERE a.attrelid = ‘“super_class”’::regclass ^

Failure Logs

I believe that the problem comes from the fact that in my Ruby application, I’ve got the following kind of structure:

class XXX < ApplicationRecord end 
class SuperClass < ApplicationRecord end 
class SubClass < SuperClass end 

Where xxx and sub_classes exist as tables in the database, but super_classes_not. It’s just a parent class with some common behavior.


Please provide any relevant information about your setup.

  • Package Version: Forest-liana 4.2.0
  • Express Version:
  • Sequelize Version:
  • Database Dialect: Postgres
  • Database Version: 12
  • Project Name:

Hi @Alexis_Clarembeau,

Can you please share a minimal example containing the inheritance problem, so we can investigate by reproducting your issue?



Thanks a lot for the help.
I’m afraid setting up a fully working rails app with a database structure, etc… will be quite complex. Wouldn’t it be possible to troubleshoot it otherwise?

I don’t see any reference to SuperClass neither in forestadmin-schema.json nor in any belongs-to or has-many relationship.

Is there a debug mode we can set up to understand why forest is making such a query?


I think I get it from the source code of Forest gem.

When trying to update any model, I pass through a ResourcesController
Which as some point calls the method extract_smart_fields_values
Which calls schema_for_resource

This method iterates through apimap and calls the methods
for every model in our schema

That’s what causing our problem.

find_model_from_collection_name(SubClass) is returning SuperClass
Because sti_child? returns false the way we’ve defined our models.

I fixed this by the “kindof hackish”:

self.table_name = nil

In my superclass