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?
Asked
Active
Viewed 1,166 times
0

Anconia
- 3,888
- 6
- 36
- 65
2 Answers
0
I don't think that the rails-console is very well suited to do administrative tasks. You are also specifying the schema in the database.yaml
I guess you would need to create a new connection in your console.

phoet
- 18,688
- 4
- 46
- 74
0
rails automatically sets the search path to
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.:
alter user foo set search_path = 'public';