spring
spring copied to clipboard
Spring isn't reloading when database is changed from SQLite to Postgress
So I'm working on my first rails 5 application. I got rails 5 installed, and then ran rails server to make sure everything was working correctly.
Then I started working on creating record. I changed databases.yml to point to postgress, created and ran migrations. Then jumped into rails console to create some records. Then I get the error that it can't find the tables.
I kinda bashed my head on this for a while. Until I tried Record.connection in the rails console to find out that it's trying to load these tables using SQLite.
Then I figured out what spring is, and how to reset it. I ran "spring stop" and tried creating the records again and it was now finally talking to postgress. So I'm guessing spring didn't notice the database change, and just kept on running thinking that SQLite was fine and dandy. Oddly enough rails db:migrate and db:create all worked fine.
Many novices might run into the same issue. And not knowing what spring is might make it a lot more difficult to get into rails. :/