gpt4 book ai didi

ruby-on-rails - 续集不适用于 postgres

转载 作者:太空宇宙 更新时间:2023-11-03 17:40:55 25 4
gpt4 key购买 nike

我正在尝试将我的 Rails 应用程序迁移到 PostGreSql,以便在与 heroku 相同的环境中工作...

我在我的 mac 上安装了 postgres、pg 和 postgres-pr,但我无法让 Taps 将我的数据库从 Heroku 拉到我的 postgresql 服务器。

My Rails Apps 无缝连接到数据库。

当我遇到 irb 时,这就是我得到的:

>> require "rubygems"
=> false
>> require "sequel"
=> true
>> DB = Sequel.postgres
NameError: uninitialized constant Sequel::Postgres::PGError
from /Library/Ruby/Gems/1.8/gems/sequel-3.17.0/lib/sequel/adapters/postgres.rb:89
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `k_require'
from /Library/Ruby/Gems/1.8/gems/sequel-3.17.0/lib/sequel/core.rb:249:in `tsk_require'
from /Library/Ruby/Gems/1.8/gems/sequel-3.17.0/lib/sequel/core.rb:72:in `check_requiring_thread'
from /Library/Ruby/Gems/1.8/gems/sequel-3.17.0/lib/sequel/core.rb:69:in `synchronize'
from /Library/Ruby/Gems/1.8/gems/sequel-3.17.0/lib/sequel/core.rb:69:in `check_requiring_thread'
from /Library/Ruby/Gems/1.8/gems/sequel-3.17.0/lib/sequel/core.rb:249:in `tsk_require'
from /Library/Ruby/Gems/1.8/gems/sequel-3.17.0/lib/sequel/database/connecting.rb:25:in `adapter_class'
from /Library/Ruby/Gems/1.8/gems/sequel-3.17.0/lib/sequel/database/connecting.rb:63:in `connect'
from /Library/Ruby/Gems/1.8/gems/sequel-3.17.0/lib/sequel/core.rb:119:in `connect'
from /Library/Ruby/Gems/1.8/gems/sequel-3.17.0/lib/sequel/core.rb:282:in `adapter_method'
from /Library/Ruby/Gems/1.8/gems/sequel-3.17.0/lib/sequel/core.rb:289:in `postgres'
from (irb):3
>>

我不明白出了什么问题。

有人有想法吗?


这是我得到的杰里米

BigMac:~ jp$ ruby -rubygems -rpg -e "p PGError"
ruby: no such file to load -- pg (LoadError)
BigMac:~ jp$ ruby -rubygems -rpostgres -e "p PGError"
ruby: no such file to load -- postgres (LoadError)

我不确定您所说的“检查路径中某处的 pg.rb 或 postgres.rb”是什么意思

我是否应该扫描 $PATH 中的所有目录并查找不需要的 pg.rb 或 postgres.rb 文件?


这很奇怪,因为我确实安装了 pg 和 postgre

这是我刚刚运行的

BigMac:/ jp$ sudo gem install pg
Password:
Building native extensions. This could take a while...
Successfully installed pg-0.10.0
1 gem installed
Installing ri documentation for pg-0.10.0...
Installing RDoc documentation for pg-0.10.0...
BigMac:/ jp$ ruby -rubygems -rpg -e "p PGError"
ruby: no such file to load -- pg (LoadError)
BigMac:/ jp$

最佳答案

我在尝试使用 pg gem 运行 heroku db:pull 到我的本地 postgresql 数据库时遇到了完全相同的问题。通过删除以下 gem 随机地解决了这个问题:

activerecord-jdbc-adapter 
activerecord-jdbcpostgresql-adapter

移除那些 gem 后再次尝试并成功地从 heroku 中提取。尝试检查您的 gem 文件以查找除您的 pg gem 之外与 postgres 相关的任何 gem 并将其删除。一切顺利

关于ruby-on-rails - 续集不适用于 postgres,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4324634/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com