无法使用gem pg_jruby创建db:create

时间:2016-11-07 23:44:01

标签: ruby windows postgresql jruby

我尝试使用pg_jruby设置jruby的postgres数据库。

当我运行' rake:db create'我收到错误说

C:/jruby-9.1.5.0/lib/ruby/gems/shared/gems/paperclip-4.2.4/lib/paperclip/storage/filesystem.rb:49: warning: `&' after local variable or literal is interpreted as binary operator
C:/jruby-9.1.5.0/lib/ruby/gems/shared/gems/paperclip-4.2.4/lib/paperclip/storage/filesystem.rb:49: warning: even though it seems like argument prefix
undefined method `conndefaults_hash' for PG::Connection:Class
Did you mean?  connectdefaults
Couldn't create database for {"adapter"=>"postgresql", "pool"=>5, "timeout"=>5000, "database"=>"development_db"}
rake aborted!
NoMethodError: undefined method `conndefaults_hash' for PG::Connection:Class
Did you mean?  connectdefaults
c:\jruby-9.1.5.0\bin\rake:22:in `<main>'
Tasks: TOP => db:create

需要pg_jruby

的Gemfile行
# as there is no .gemspec in the source.
gem 'pg', '0.18', :platform => :jruby, :git => 'git://github.com/headius/jruby-pg.git', :branch => :master

的database.yml

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
#
default: &default
  adapter: postgresql
  pool: 5
  timeout: 5000

development:
  <<: *default
  database: development_db

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  <<: *default
  database: test_db

production:
  <<: *default
  database: production_db

0 个答案:

没有答案