I have a PostgreSQL database for my Rails application. In the schema named 'public' the main Rails models tables are stored etc. I have created a 'discogs' schema which will have tables with names that are sometimes the same as in the 'public' schema – which is one of the reasons that I'm using schemas to organize this.
How would I setup models from the 'discogs' schema in my app? I will be using Sunspot to let Solr index these models as well. I'm unsure of how you would do this.
Best Answer
PostgreSQL adapter schema_search_path in database.yml does solve your problem?
Or, you can to specify different connections for each schema:
After each connection defined, create two models:
And, all your models inherit from the respective schema:
I hope it helps.