While going through Michael Hartl's book on RubyonRails, I decided to go with postgresql instead of the sqlite3 version used in the book(Although, I can't get the sqlite3 gem install in RubyonRails but am less concern since my focus is on using pg) and this are the steps I have taken so far
Step1: I downloaded the postgreSQL version 10.7 and installed it Step2: Add The path to the path environment Step3: I added it to the
Gemfile like this 'pg', '~>10.7'
Step4: Run
Rails bundle
WHAT I GOT FROM THE CONSOLE
Could not find gem 'pg (= 10.7) x64-mingw32' in any of the gem sources listed in your Gemfile.
My question is how can I install the version or any other version of pg on Ruby on Rails in windows
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.