Who can put me through how I can install postgresql 10.7 in Ruby on Rails. Am using windows8.1.
I find it hard that few resources(although, I haven’t find one myself) teach us how to do it.
Do you want to know how install postgres on Windows, or have you already installed it and want to configure it in Ruby on Rails?
Those are two distinct steps
1
Finally, have been able to figure it out myself and these are what I do I comment out the sqlite3 like this
gem install ‘sqlite3’
replace it with
gem install ‘pg’
after that, I go to
config folder
and select the
database.yml
and change the settings to these
default: &default
adapter: postgresql
encoding: unicode
host: localhost
username: postgresql
password: your password
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
development:
<<: *default
database: db_dating
test:
<<: *default
database: db_dating_test
The name of the database I created is called
db_dating
so remember to change yours to your db name
Yeah, SQLite is the default database for new rails projects.
If you are generating a new project, you can use the -d
flag top specify the database you require:
rails new myapp -d postgresql
If you want to swap out the database on an existing project, you will need to do what you have done and set things up manually.
There is a command to automate this coming to the next version of Rails:
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.