我正在尝试将我的 Rails 应用程序迁移到 PostGreSql,以便在与 heroku 相同的环境中工作......
我在我的 Mac 上安装了 postgres、pg 和 postgres-pr,但我无法让 Taps 将我的数据库从 Heroku 拉到我的 postgresql 服务器上。
我的 Rails 应用程序无缝连接到数据库。
当我遇到 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$