How to add a new schema to an existing rails configuration?

Hi there,

I recently added a new schema to my PostgreSQL database.
I already have a running ForestAdmin linked to my public schema.

I have a relation between a table (let’s call it new_table) in my new schema and the table User in my public schema.

When starting my rails app, I got the following warning :

Unknown association new_table on class User

In my forest_liana.rb, I do not specify any schema so I guess ForestAdmin is using public by default.
I also include the User model explicitly in ForestLiana.included_models.

How can I tell forest to import both public and the new schema in order to fix this warning ?

Thanks !

Hello @PMerlet and welcome to the community !

For us to be able to give you the best possible support, it would be really helpful if you could fill out the template.

## Context

<!-- Please provide in this **mandatory section**, the relevant information about your configuration: -->
- Project name: ...
- Team name: ...
- Environment name: ...
- Agent technology: (nodejs, php, rails, python)
- Agent (forest package) name & version: ...
- Database type: ...
- Recent changes made on your end if any: ... 

Best regards,

Hi @dogan.ay,

Project name : Ilek BO
Team name : Power Users
Environment name : production
Agent technology : rails
Agent name & version : forest-rails 8.3.1
Database type : Postgres
Recent changes : added a new schema that is referenced by a model from the public schema

Best regards,

Pierre

Hello @PMerlet,

Could you share your model corresponding to the new_table and also do you have added self.table_name = ‘your_other_schema.new_table' in this model ?

1 Like