Ruby error with postgres

Im getting the following error while using postgres from ruby. Im new
to ruby any help would be appreciated.

c:/ruby/lib/ruby/1.8/readbytes.rb:21:in `read': Invalid argument
(Errno::EINVAL)
  from c:/ruby/lib/ruby/1.8/readbytes.rb:21:in `readbytes'
  from c:/ruby/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/
message.rb:32:in `read'
  from c:/ruby/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/
connection.rb:30:in `initialize'
  from c:/ruby/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/
connection.rb:29:in `loop'
  from c:/ruby/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/
connection.rb:29:in `initialize'
  from c:/ruby/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/
postgres-compat.rb:23:in `new'
  from c:/ruby/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/
postgres-compat.rb:23:in `initialize'
  from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/postgresql_adapter.rb:24:in
`connect'
  from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/postgresql_adapter.rb:24:in
`postgresql_connection'
  from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/abstract/connection_specification.rb:
262:in `send'
  from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/abstract/connection_specification.rb:
262:in `connection_without_query_cache='
  from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/query_cache.rb:54:in `connection='
  from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/abstract/connection_specification.rb:
230:in `retrieve_connection'
  from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/connection_adapters/abstract/connection_specification.rb:
78:in `connection'
  from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/
active_record/base.rb:427:in `find_by_sql'

That's because Rails can't read from the connection. Try restarting postgresql.