PostgreSQL, postgres gem, rails2.pdf, http://ruby.scripting

Hello people…

In the rails2.pdf Dave T says:

Rails works with the DB2, MySQL, Oracle, Postgres,…

The database drivers are all written in C and are primarily distributed
in
source form.

Then he lists this site:
http://ruby.scripting.ca/postgres/

Then he says,

There is a pure-Ruby version of the Postgres adapter available. Download
postgres-pr from the Ruby-DBI page at
http://rubyforge.org/projects/ruby-dbi

So I understand all this and I’m happy.

But then I bumped into this page:

http://www.robbyonrails.com/articles/2006/05/29/install-ruby-rails-and-postgresql-on-osx

It suggests that I install a gem using a command line like this:

gem install postgres

So, I tried it and it installed okay.

I then rails a tmp_app and edited my database.yml

I tested with…

rake db:migrate

It ran fine.

I should be happy but I’m not.
Actually I’m happy that I can now do development.

But…
I’m not sure how rails is connected to my PostgreSQL database.

Q1: What is the best way to connect Rails to PostgreSQL in a Production
environment?

Q2: For Production, should I use the postgres gem?

Q3: The software here: http://ruby.scripting.ca/postgres/
Should I try to figure out how to make it serve as a layer between
my
Rails app
and PostgreSQL? Or, should I ignore it?

-Dan

Hi Again,

I looked here:

ruby/gems/1.8/gems/postgres-0.7.1/README

It appears to me that the gem is a wrapper for the code here:

http://ruby.scripting.ca/postgres/

So, to answer my own questions:

Q1: What is the best way to connect Rails to PostgreSQL in a Production
environment?
A: Use the gem

Q2: For Production, should I use the postgres gem?
A: Yes

Q3: The software here: http://ruby.scripting.ca/postgres/
Should I try to figure out how to make it serve as a layer between
my
Rails app
and PostgreSQL? Or, should I ignore it?
A: Ignore it

-Dan

Dan B. wrote:

Hi Again,

I looked here:

ruby/gems/1.8/gems/postgres-0.7.1/README

It appears to me that the gem is a wrapper for the code here:

http://ruby.scripting.ca/postgres/

So, to answer my own questions:

Q1: What is the best way to connect Rails to PostgreSQL in a Production
environment?
A: Use the gem

Q2: For Production, should I use the postgres gem?
A: Yes

Q3: The software here: http://ruby.scripting.ca/postgres/
Should I try to figure out how to make it serve as a layer between
my
Rails app
and PostgreSQL? Or, should I ignore it?
A: Ignore it

-Dan

Hi All,

I am a newbie in Ruby-Rails. Actually we are using postgre SQL and Ruby
application to access the DB. I have made the controller and the model
classes. My database.yml contains:

development:
adapter: postgresql
database: test
username: poc
password: poc
host: localhost:5000

test:
adapter: postgresql
database: test
username: poc
password: poc
host: localhost:5000

production:
adapter: postgresql
database: test
username: poc
password: poc
host: localhost:5000

I have actually configured my postgresql to listen to port 5000 rather
than 5432(default). When I hit the url http://127.0.0.1:3000/Testing/new
it is showing an error:

Bad file descriptor - connect(2)

My model -> testing.rb

class Testing < ActiveRecord::Base

end

My Controller -> testing_controller.rb

class TestingController < ApplicationController
scaffold :testing
end

How can I resolve this problem… Thanks in advance…

Regards,
Janeve

Janeve George <[email protected]…> writes:

password: poc
host: localhost:5000

How can I resolve this problem… Thanks in advance…

These are the comments that used to be in the default database.yml
file… not
sure whose donkey idea was it to remove all this stuff? :slight_smile: Anyway
maybe it
will help you:

Connect on a TCP socket. Omitted by default since the client uses a

domain socket that doesn’t need configuration.

#host: remote-database
#port: 5432

Robert Treat

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs