Search code examples
ruby-on-railspostgresqlgemfilepg

recompiling database.yml file with gemfile? ruby on rails


I'm new to Ruby on Rails and postgreSQL and had a question. Does the database.yml file get compiled when you run bundle install on a Gemfile? Initially my gemfile had sqlite3, but I changed it to pg and tried to run bundle install again to recompile the database.yml file, but the file still says it's using SQLite.

development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000

I want the adapter to be switched to postgresql and I believe some other fields should be switched when using pg, but I'm unsure. Can anyone clarify this for me, thank you.


Solution

  • No, database.yml is not recompiled automatically. When you change the gem in Gemfile, you need to also change the file:

    development:
      adapter: postgresql
      database: dbname
      username: user
      password: password
      encoding: unicode