不确定我做错了什么,我试着把我的database.yml中的生产部分省略但是没有用,现在我有了这个:
development:
...
test:
...
production:
database: myapp_production
pool: 5
我的宝石文件:
gem 'pg', :group => :production
gem 'mysql2', '>= 0.3.18', '< 0.5', :group => [:development, :test]
运行时出现此错误:
Running rake db:setup on ⬢ still-crag-69600... up, run.8579 (Free)
rake aborted!
ActiveRecord::AdapterNotSpecified: 'production' database is not configured. Available: ["development", "test"]
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/connection_specification.rb:246:in `resolve_symbol_connection'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/connection_specification.rb:227:in `resolve_connection'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/connection_specification.rb:141:in `resolve'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_handling.rb:55:in `establish_connection'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:139:in `create_current'
答案 0 :(得分:2)
您需要在生产中添加:
do.call(rbind, lapply(1:2, function(i) {
x <- randomizeMatrix(com.dat, null.model = "richness", iterations = 1000)
unlist(beta.multi.abund(x, index.family = "bray"))
}))
# beta.BRAY.BAL beta.BRAY.GRA beta.BRAY
#[1,] 0.7686567 0.008321701 0.7769784
#[2,] 0.6693548 0.012815704 0.6821705
确保您已创建source code。添加heroku postgresql插件时会自动设置 adapter: postgresql
url: <%= ENV['DATABASE_URL'] %>
环境变量。
答案 1 :(得分:0)
在database.yml中尝试以下代码:
development:
adapter: postgresql
encoding: utf8
reconnect: false
database: db_name
pool: 5
username: root
password: root
production:
adapter: postgresql
encoding: utf8
reconnect: false
database: db_name
pool: 5
username: root
password: root
test:
adapter: postgresql
encoding: utf8
reconnect: false
database: db_name
pool: 5
username: root
password: root