Setting up PostgreSQL 8.x with Ruby 1.8.6 on Rails 2.3.4

12
Nov
0

PostgreSQL is a:

Sophisticated open-source Object-Relational DBMS supporting almost all SQL constructs, including subselects, transactions, and user-defined types etc…

The Problem

  1. You have just installed PostgrelSQL.

  2. You have generated your rails app

    rails myApp -d postgresql
  3. You try to run the server

    ruby script/server
  4. You add your DB details in config/database.yml and you notice this note.

    On Windows:

    #   gem install ruby-postgres
    #       Choose the win32 build.
    #       Install PostgreSQL and put its /bin directory on your path.
  5. Install that gem

    gem install ruby-postgres

    * I didn’t get prompted to choose the win32 build but it all installs well.

  6. From now on, to cut this short, few of the errors that you might encounter:

    Please install the postgres adapter: 'gem install activerecord-postgres-adapter'

    if you try to install that gem you will get this Error

    ERROR:  could not find activerecord-postgres-adapter locally or in a repository

    So try to install this gem instead “ruby-postgres” like i mentioned before.

    Another prompt you might get is when trying to run the server:

    The ordinal 284 could not be located in the dynamic link library SSLEAY32.dll

The Solution

  1. Copy both “ssleay32.dll” and “libeay32.dll” from Postgresql bin directory. On my machine that’s:

    C:\Program Files\PostgreSQL\8.4\bin
  2. and put them in Ruby’s bind directory. On my machine that’s:

    C:\Ruby\bin
  3. * It seems those files were already in Ruby’s bin folder, so overwrite the ones there.

  4. And it works!


Enjoy this article?

Consider subscribing to our RSS feed!

Filed under: Ruby on Rails

// No Comments

No comments yet.

Leave a comment

RSS feed for comments on this post