2015-04-15 19 views
0

我有一個Sinatra應用程序通過Activerecord使用Postgres。我使用的是Mac上RVM和一些寶石包括:無法加載'active_record/connection_adapters/postgresql_adapter'

activerecord 
activesupport 

當我運行服務器(薄),我得到一個錯誤:

Could not load 'active_record/connection_adapters/postgresql_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile.

適配器設置爲postgresql在配置,我檢查了我的RVM和路徑:我的Gem安裝路徑設置正確,我可以看到正確安裝的適當的Gem,並且特定的適配器也在那裏,所以真的不知道會發生什麼或者如何進一步解決這個問題?

使用Ruby 2.0.0-p598,ActiveRecord的和的ActiveSupport 4.1.4

-

此外調試嘗試:

ruby -v

ruby 2.0.0p598 (2014-11-13 revision 48408) [x86_64-darwin14.0.0]

which ruby

/Users/user/.rvm/rubies/ruby-2.0.0-p598/bin/ruby

gem env(相關部分):

  • EXECUTABLE DIRECTORY: /Users/user/.rvm/gems/ruby-2.0.0-p598/bin
  • GEM PATHS:

  • SHELL PATH:

    • /Users/user/.rvm/gems/ruby-2.0.0-p598/bin
    • /Users/user/.rvm/gems/[email protected]/bin
    • /Users/user/.rvm/rubies/ruby-2.0.0-p598/bin

ls $GEM_HOME/gems

activerecord-4.1.4 activesupport-4.1.4

真叫還有什麼我可以看看


database.yml

development: 
    adapter: postgresql 
    database: example_db 
    username: example_user 
    password: example_password 
    host: localhost 
虧損
+0

請發佈您的database.yml文件。 (請務必先刪除其中的任何密碼) – joelparkerhenderson

+0

您是否需要在任何地方使用activerecord-jdbcpostgresql-adapter? – mcfinnigan

+0

我將添加我的database.yml,我不需要任何地方的適配器。 – waffl

回答

0

我採取的下一個調試步驟是嘗試使用rvm來安裝全新的ruby版本。這工作,所以我用rvm完全刪除我的老版本的紅寶石與rvm remove 2.0.0-p598並重新安裝它再次rvm install 2.0.0-p598

我仍然不知道可能發生了什麼,但也許不知何故寶石緩存/構建中的某些東西已損壞,所以如果有人遇到這樣的一個奇怪的錯誤,一切就緒,但仍然無法正常工作,嘗試用rvm清除所有內容並重新安裝。