0

我正在尝试使用 rake db:create 创建数据库,但出现以下错误

** Invoke db:create (first_time)

** Invoke db:load_config (first_time)

** Invoke rails_env (first_time)

** Execute rails_env

** Execute db:load_config

** Execute db:create

rake aborted!

undefined method `[]' for false:FalseClass

/usr/lib/ruby/gems/1.9.1/gems/activerecord-3.0.10/lib/active_record/railties
/databases.rake:32:in `block (2 levels) in <top (required)>'

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'


/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'

/usr/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'

/usr/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'

/usr/bin/rake:23:in `load'

/usr/bin/rake:23:in `<main>'
Tasks: TOP => db:create

我检查了我的 database.yml 文件,它是空的。我是 JRuby 的新手。我在我的项目中使用以下 gems 列表,它表明有两个数据库,一个是 pg,另一个是 sqlite,它们与 ActiveRecord-JDBC 适配器一起使用。我的 gem 文件如下所示:

gem 'rails', '~>3.0.10'
gem 'builder', '~> 2.1.2'    
gem 'exception_notification', '~> 2.5.2'
gem 'rubyzip', :require => 'zip/zip'
gem 'haml', '3.1.3'                  #, :git => 'git://github.com/nex3/haml.git'
gem 'sass', '3.1.7'                  #, :git => 'git://github.com/nex3/haml.git'
gem 'compass', '0.11.5'              #, :git => 'git://github.com/chriseppstein/compass.git'
gem 'formtastic', '2.0.0.rc4'        #, :git => 'git://github.com/justinfrench/formtastic.git'
gem 'inherited_resources', '1.3.0   ' #, :git => 'git://github.com/josevalim/inherited_resources.git'
gem 'simple-navigation', '3.5.0'     #, :git => 'git://github.com/andi/simple-navigation.git'
gem 'tabs_on_rails', '2.0.2'         #, :git => 'git://github.com/weppos/tabs_on_rails.git'
gem 'dynamic_form', '1.1.4'          #, :git => 'git://github.com/rails/dynamic_form.git'
gem 'show_for', '0.2.4'
gem 'liquid', '2.3.0'
gem 'crack'
gem 'jquery-rails', '1.0.14'
gem 'jrails', '0.6.0'
gem 'sprockets', '1.0.2'
gem 'hominid', '3.0.4'
platforms :jruby do
  gem 'ActiveRecord-JDBC', '0.5'
  gem 'activerecord-jdbcpostgresql-adapter', '1.2.0'
  gem 'activerecord-jdbcsqlite3-adapter', '1.2.0'
end
platforms :ruby do
  gem 'pg', '0.13.2'
  gem 'sqlite3', '1.3.4'
end
gem 'silent-postgres', '0.1.1'
gem 'automatic_foreign_key', '1.3.0'
gem 'friendly_id', '~> 4.0.3'
gem 'rack-ssl', :require => 'rack/ssl'
# paginators
gem 'kaminari', '~> 0.12.4'
gem 'aasm', '~> 3.0.6'
gem "meta_search", '1.0.6' #, :git => 'git://github.com/ernie/meta_search.git'
gem 'devise', '1.5.3'      #, :git => 'git://github.com/plataformatec/devise.git'
gem 'cancan', '1.6.5'      #, :git => 'git://github.com/plataformatec/devise.git'
gem 'nokogiri',              '1.5.0'
gem 'hpricot', '0.8.4'
gem 'jruby-rack', '1.0.10', :platforms => :jruby
gem 'rack', '1.2.3'
gem 'rack-html5', '1.0.2'
gem 'rack-html5-rails_helper', '1.0.1'
gem 'html5-boilerplate', '1.0.0'
gem 'rmagick', '2.13.1', :platforms => :ruby
gem 'rmagick4j', '0.3.7', :platforms => :jruby
gem 'jruby-openssl', '0.7.4', :platforms => :jruby
gem 'ruby_parser', '2.0.6'
gem 'delayed_job', '2.1.4', :platforms => :ruby
gem 'resque', '1.19.0', :platforms => :jruby
gem 'clockwork', '0.2.4'
gem 'stalker', '0.9.0'
gem 'meta-tags', '1.2.4', :require => 'meta_tags'
gem 'carrierwave', '0.5.7'
gem 'mini_magick', '3.3'
gem 'activemerchant', '~> 1.22.0'
gem 'xeroizer', '~> 0.4.1'
gem 'quickeebooks', :git => 'git://github.com/ruckus/quickeebooks.git'

gem 'bson_ext'
gem 'mongo_mapper'

group :development do
  gem 'capistrano', '2.9.0'
  gem 'capistrano-ext'
  gem 'rvm-capistrano', '~> 1.0.2'
  gem 'awesome_print', '0.4.0'
end

gem 'backup', '=3.0.22' # :git => 'git://github.com/meskyanichi/backup.git'
gem 'whenever', :require => false
gem 'roo', '1.9.7'
gem 'ffaker', '1.8.1'
gem 'ckeditor', '3.6.3'
gem 'rake', '0.9.2.2'
gem 'ssl_requirement', '0.1.0'
gem 'unicorn', '4.1.1'

有任何想法吗??

4

1 回答 1

0

您是否有意使用旧的 activerecord 版本?(3.0)?为什么你的 database.yml 是空的,你可以尝试用正确的值填充它:)

于 2012-10-11T09:28:11.350 回答