2012-02-27 56 views
1

----------------編輯----------------紅寶石PostgreSQL的基於AMD64

我試着杜克說了什麼,仍然沒有任何工作。 嘗試了一些之後,我發現問題不在DataMapper上。 事實上,它是在AMD64上失敗的postgreSQL適配器。

我的PostgreSQL的二進制分發版(最後一個在其網站上找到)和我做一個

gem install... 

有人能幫助我所有的寶石?

---------------- ORIGINAL ----------------

繼從 「入門」 DataMapper的網站,我跑過這個例子:

# A Postgres connection: 
DataMapper.setup(:default, 'postgres://localhost/the_database_name') 

我已經安裝postgre數據庫,DataMapper的每依賴性(包括開發-KIT) 下面的代碼:

gem 'data_mapper' 
require 'dm-core' 
require 'dm-migrations/adapters/dm-postgres-adapter' 
# If you want the logs displayed you have to do this before the call to setup 
DataMapper::Logger.new($stdout, :debug) 

# A Postgres connection: 
DataMapper.setup(:default, 'postgres://localhost/test') 

但磨片n個I運行它,出現此錯誤:

require "dm-#{name}-adapter" 

顯然,沒有找到文件:關於 「load_adapter」 功能發生

D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': 193: %1 n?est pas une application Win32 valide. - D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/do_postgres-0.10.8-x86-mingw32/lib/do_postgres/1.9/do_postgres.so (LoadError) 
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/do_postgres-0.10.8-x86-mingw32/lib/do_postgres.rb:30:in `rescue in <top (required)>' 
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/do_postgres-0.10.8-x86-mingw32/lib/do_postgres.rb:25:in `<top (required)>' 
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-postgres-adapter-1.2.0/lib/dm-postgres-adapter/adapter.rb:1:in `<top (required)>' 
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-postgres-adapter-1.2.0/lib/dm-postgres-adapter.rb:1:in `<top (required)>' 
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `require' 
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require' 
    from D:/dev/Ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require' 
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core/adapters.rb:163:in `load_adapter' 
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core/adapters.rb:133:in `adapter_class' 
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core/adapters.rb:13:in `new' 
    from D:/dev/Ruby/lib/ruby/gems/1.9.1/gems/dm-core-1.2.0/lib/dm-core.rb:228:in `setup' 
    from D:/dev/workspace/ruby/training/bin/pg/main.rb:8:in `<top (required)>' 
    from -e:1:in `load' 
    from -e:1:in `<main>' 

錯誤。 我試過按照建議here手動包含適配器,但沒有成功。

有什麼想法?謝謝

回答

1

您必須安裝dm-postgres-adapter(gem install dm-postgres-adapter)然後安裝data_mapper(gem install data_mapper)。

+0

是安裝順序重要嗎?因爲我在安裝datamapper後重新安裝了postgres適配器 – kitensei 2012-02-28 08:07:48