Search code examples
ruby-on-railspostgresqlrubymine

Ruby-on-rails + Postgres: configuration issue


I`m getting some troubles after installing in Windows 7 ruby 1.8.6, rails 2.3.8, some basic gems(also ruby-postgres) and the IDE Rubymine from Jetbrains.

So, after creating a simple project with Rubymine(default PostgresSQL configuration in database.yml), I run it in localhost:3000 but it seems not be recognizing nothing like:

When I first click on the main page of Ruby on Rails at "About your application’s environment" it returns an Error: "We're sorry, but something went wrong." and even when I create a simple controller with a view and opens the right URL it tells the same problem.

I don't know if the problem is about database or something like this, but also I would like to know how to configure it in database.yml.

Default:

  adapter: postgresql
  encoding: unicode
  database: (name of the project)_(type: test, production or development)
  pool: 5
  username: (name of the project)
  password: (no password)

What I did:

  adapter: postgresql
  encoding: utf-8
  database: (name of database)_(type: test, production or development)
  pool: 5
  username: ruby
  password: (no password)
  host: localhost
  port: 3000

Is it right?


Solution

  • assuming your project is called foo, and you've created the correct databases in postgres, and postgres is listening on the default port on localhost

     development:
        adapter: postgresql
        encoding: utf-8
        database: foo_development 
        pool: 5
        user: ruby
    

    As stated port 3000 is where rails listens, so that will cause problems. Also you need to make sure the pga_hba.conf allows connections to the database.