无法加载'active_record / connection_adapters / postgresql_adapter' [英] Could not load 'active_record/connection_adapters/postgresql_adapter'

查看:525
本文介绍了无法加载'active_record / connection_adapters / postgresql_adapter'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Sinatra应用程序,通过Activerecord使用Postgres。我在Mac上使用RVM和许多宝石,包括:

  activerecord 
activesupport

当我运行服务器(瘦)时,出现错误:


无法加载'active_record / connection_adapters / postgresql_adapter'。
确保config / database.yml中的适配器有效。如果您使用
以外的适配器,而不是'mysql','mysql2','postgresql'或'sqlite3',则必须将
添加到Gemfile所需的适配器gem中。



适配器在配置中设置为 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 (releva nt部分):



  • 可执行文件目录:/Users/user/.rvm/gems/ruby-2.0。 0-p598 / bin

  • 创业板路径:


    • / Users / user /。 rvm / gems / ruby​​-2.0.0-p598

    • /Users/user/.rvm/gems/ruby-2.0.0-p598@global


  • SHELL PATH:


    • /Users/user/.rvm/ gems / ruby​​-2.0.0-p598 / bin

    • /Users/user/.rvm/gems/ruby-2.0.0-p598@global/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

 开发:
适配器:postgresql
数据库:example_db
用户名:example_user
密码:example_password
host:localhost


解决方案

A我采取的下一个调试步骤是尝试使用rvm来安装全新的ruby版本。这工作,所以我用rvm完全删除我的老版本的红宝石与 rvm删除2.0.0-p598 并重新安装它再次 rvm安装2.0。 0-p598



我仍然不知道可能发生了什么,但也许不知何故宝石缓存/构建中的某些内容已损坏,所以如果任何人遇到这样的奇怪错误,一切就绪,但仍然无法正常工作,请尝试用rvm清除所有内容并重新安装。


I have a Sinatra app using Postgres via Activerecord. I'm using RVM on a Mac and a number of gems including:

activerecord
activesupport

When I run the server (thin), I get an error:

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.

The adapter is set to postgresql in the config, and I've checked my RVM and paths: My Gem install path is set properly, and I can see the appropriate gems installed properly, and the specific adapter is there too, so really not sure what could be happening or how to further troubleshoot this?

Using Ruby 2.0.0-p598, activerecord and activesupport 4.1.4

--

Further debugging attempts:

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 (relevant parts):

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

    • /Users/user/.rvm/gems/ruby-2.0.0-p598
    • /Users/user/.rvm/gems/ruby-2.0.0-p598@global
  • SHELL PATH:

    • /Users/user/.rvm/gems/ruby-2.0.0-p598/bin
    • /Users/user/.rvm/gems/ruby-2.0.0-p598@global/bin
    • /Users/user/.rvm/rubies/ruby-2.0.0-p598/bin

ls $GEM_HOME/gems

activerecord-4.1.4 activesupport-4.1.4

Really at a loss for what else I can look into


database.yml

development:
  adapter: postgresql
  database: example_db
  username: example_user
  password: example_password
  host: localhost

解决方案

A next debugging step I took was to try using rvm to install a whole new version of ruby. This worked, so I used rvm to completely remove my old version of ruby with rvm remove 2.0.0-p598 and reinstall it again rvm install 2.0.0-p598.

I still have no idea what may have happened, but perhaps somehow something in the gem caches/builds were corrupted, so if anyone runs into a weird error like this where everything is in place but still doesn't work, try clearing everything with rvm and reinstalling.

这篇关于无法加载'active_record / connection_adapters / postgresql_adapter'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆