Using postgres rails/rake fails

hello list,

yesterday i installed a fresh rails installation with a proper upgrade
of gem to version 1.0.1
i saw, there is still a gem package to support postgresql known as
postgres-0.7.9.2008.01.09
on rubyforge, its the newest one of stable postgres support for ruby
additionally i installed, of course, a the postgres database on my
machine to
C:\Programme\PostgreSQL\8.2

after setting up a new rails project and editing the database.yml
i execute the command rake db:create:all to create all databases on
the fly :slight_smile:
and the prompt shows me:

D:\rails\tree>rake db:create:all --trace
(in D:/rails/tree)
** Invoke db:create:all (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:create:all
rake aborted!
no such file to load – postgres
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/
dependencies.rb:496:in require' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/ dependencies.rb:342:innew_constants_in’
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/
dependencies.rb:496:in require' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/ core_ext/kernel/requires.rb:7:inrequire_library_or_gem’
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/
core_ext/kernel/reporting.rb:11:in silence_warnings' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/ core_ext/kernel/requires.rb:5:inrequire_library_or_gem’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/
connection_adapters/postgresql_adapter.rb:7:in postgresql_connection' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ connection_adapters/abstract/connection_specification.rb:291:insend’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/
connection_adapters/abstract/connection_specification.rb:291:in
connection=' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ connection_adapters/abstract/connection_specification.rb:259:inretrieve_connection’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/
connection_adapters/abstract/connection_specification.rb:78:in
connection' c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/tasks/databases.rake: 36:increate_database’
c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/tasks/databases.rake:20
c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/tasks/databases.rake:
5:in each_value' c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/tasks/databases.rake:5 c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:incall’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:in execute' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:ineach’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:in execute' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:369:ininvoke’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:362:in
synchronize' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:362:ininvoke’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:1935:in run' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:1935:ineach’
c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:1935:in run' c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.2/bin/rake:7 c:/ruby/bin/rake.bat:20:inload’
c:/ruby/bin/rake.bat:20

ive got no idea whats wrong?

many thanks for help

best regards

On 1/15/08, inriz [email protected] wrote:

rake aborted!
no such file to load – postgres

adapter: postgresql

It’s postgresql, not postgres.


Greg D.
http://destiney.com/

the database.yml is okay
i set the adapter to postgresql for each database

im working under win xp, can it be that postgres
doesnt work under xp well?
i read about it and installed postgres-pr
but the rake task to create the databases also
doesnt work for me.

On 1/15/08, inriz [email protected] wrote:

the database.yml is okay
i set the adapter to postgresql for each database

im working under win xp, can it be that postgres
doesnt work under xp well?

No idea, haven’t ever tried Rails on windoze.

i read about it and installed postgres-pr
but the rake task to create the databases also
doesnt work for me.

What errors are you getting now? Same?

Did you get any errors when you installed the gem? Can you actually
locate the gem directory on your system?

What happens when you try to load it manually, outside of Rails?

irb -r postgres


Greg D.
http://destiney.com/

Hi list,

I have pretty much the same problem on Mac OS X 10.5, Rails 2.0.2 and
Postgres 8.2.4.
In database.yml I have

adapter: postgresql

The gems I have installed are:
$ gem list

*** LOCAL GEMS ***

actionmailer (2.0.2, 1.3.6)
actionpack (2.0.2, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.0.2, 1.15.6)
activeresource (2.0.2)
activesupport (2.0.2, 1.4.4)
libxml-ruby (0.3.8.4)
postgres (0.7.9.2008.01.09, 0.7.9.2007.12.22)
postgres-pr (0.4.0)
rails (2.0.2, 1.2.6)
rake (0.8.1)
rubygems-update (1.0.1)
rubyosa (0.4.0)
sources (0.0.1)

trying

$ irb -r postgres

I get
/usr/local/lib/ruby/1.8/irb/init.rb:252:in require': no such file to load -- postgres (LoadError) from /usr/local/lib/ruby/1.8/irb/init.rb:252:inload_modules’
from /usr/local/lib/ruby/1.8/irb/init.rb:250:in each' from /usr/local/lib/ruby/1.8/irb/init.rb:250:inload_modules’
from /usr/local/lib/ruby/1.8/irb/init.rb:21:in setup' from /usr/local/lib/ruby/1.8/irb.rb:54:instart’
from /usr/local/bin/irb:13

Any ideas?

Looks like this problem is due to outdated files.
There is a rake task to update a project:

rake rails:update

Update both configs, scripts and public/javascripts from Rails

Running this sorts out the problem.

I have the same problems under Mac OS X Leopard. I am using ruby
1.9.2p180, Rails 3.0.5, rake 0.8.7 and gem 1.5.9. I installed
postgres-pr, but after a rake db:migrate I got this message:

rake aborted!
no such file to load – pg
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in
require' /opt/local/lib/ruby1.9/gems/1.9.1/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:inblock in require’
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in
block in load_dependency' /opt/local/lib/ruby1.9/gems/1.9.1/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:596:innew_constants_in’
/opt/local/lib/ruby1.9/gems/1.9.1/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in
load_dependency' /opt/local/lib/ruby1.9/gems/1.9.1/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:inrequire’

And this command here

rake rails:update

does not solve my problem. I am still unable to execute rake db:migrate.
But the command

rails dbconsole

works fine. Any ideas what’s going on?

On Tue, Mar 22, 2011 at 9:30 AM, Robert R. [email protected] wrote:

/opt/local/lib/ruby1.9/gems/1.9.1/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in

rails dbconsole

works fine. Any ideas what’s going on?

Not sure, but do you have the ‘pg’ gem in your gemfile and installed?

On Mar 22, 3:30pm, “Robert R.” [email protected] wrote:

/opt/local/lib/ruby1.9/gems/1.9.1/gems/activesupport-3.0.5/lib/active_suppo
rt/dependencies.rb:225:in
rake rails:update

does not solve my problem. I am still unable to execute rake db:migrate.
But the command

rails dbconsole

works fine. Any ideas what’s going on?

rails dbconsole just fires up the database’s native command line tool,
using database.yml to pull out the host and so on, so it will worked
even if the gem used for that database is missing etc.
The gem used for postgres these days is called pg - make sure that is
in your Gemfile (and of course run bundle install after modifying your
Gemfile)

Fred

I could resolve the problem after reading this blog post and all the
comments:

http://flux88.com/blog/installing-postgresql-for-rails-on-mac-os-x/