I need to add a new user to my app's Postgres User
table located in the test
schema. When I access the console, rails automatically sets the search path to "$user",public
and the new user record is saved to the public
schema, not the test
schema. Is there a way to add records to the User
table within the test
schema using the console?
Rails console search path and Postgres
1.2k Views Asked by Anconia At
2
No, it's not Rails - it's Postgres doing that. It's the default search path defined in Postgres. See the manual for details: http://www.postgresql.org/docs/current/static/ddl-schemas.html#DDL-SCHEMAS-PATH
If you want a different search path for that user, use
alter user
to change the user's search path, e.g.: