How to install sqlite or postgresql on Windows 8 for rubies on rails settings?

I am trying to install a database as part of my Ruby Rails setup. I am running a 64 bit Windows 8 based x64 machine. My ruby ​​version is 2.1.3p242, rails version is 4.0.0, sqlite3 version is 3.8.6 and postgresql version is 9.3 At first I tried to install sqlite3 by following the steps given in this SO answer , but I get this error

`require': Could not load 'active_record/connection_adapters/sqlite3_adapter'. Make sure that the adapter in config/database.yml is valid.


My database.yml has the value "sqlite3" as the value for the adapter key for all three environments.
Then I will try to install postgresql which was installed correctly. I activated the pgadmin3 GUI and started the database server. But when I start the rails server. I am getting the following error:

C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/pg-0.17.1-x64-mingw32/lib/pg.rb:10:in `re
quire': cannot load such file -- 2.1/pg_ext (LoadError)




source to share

2 answers

You need to use the pre-release pg.

  • Installation

    gem install pg -v 0.18.0.pre20141117110243 --pre

  • Add to Gem File

    gem 'pg', '~> 0.18.0.pre20141117110243'

  • Updating with a package

    bundle update



If you want to use PostgreSQL, you need to do 2 things:

  • Install PostgreSQL on Windows using these instructions

  • Configure your rails project to use PostgreSQL as follows:

rails new todo --database=postgresql

On a related note, if you want to do web development with Ruby on Rails, I recommend that you install Ruby, Gems, Git, Rails, and the IDE. All instructions are in the Start Programming Now book



All Articles