When I connect to my psql database and type: Select * from User; It returns 1 user. Then when I go into rails console and type User.all it returns an empty array. Why would this be? Could it possibly be an issue with the connection to the database? Thanks
Asked
Active
Viewed 50 times
1
-
Have you applied `default_scope` to `User` model? – Arslan Ali Mar 07 '16 at 17:38
2 Answers
0
Make sure you are accessing the same database in console. You can connect to either your test, development or production database using console.
Try to connect as follows and see what "User.all" returns:
rails console test
rails console development
rails console production

halmeetdave
- 356
- 1
- 3
- 9
0
Please, check if you are using default scope in your application. For that default scope there might be no user. In that case, use:
User.unscoped

Ahsan Ellahi
- 336
- 2
- 6