哇我好几天都被困在这个上面了.我在Heroku上连接到database.yml时遇到问题.我在Cedar和ruby 1.9.2.我的dev和test dbs是sqlite3,prod db是postgreSQL来处理Cedar规则.这是我的ruby脚本中的代码:
Rails.env.production? ? (env = "production") : (env = "development")
dbconfig = YAML::load(File.open('config/database.yml'))[env]
ActiveRecord::Base.establish_connection(dbconfig)
Run Code Online (Sandbox Code Playgroud)
一切顺利,但当我推到Heroku时,我得到:
ArgumentError: syntax error on line 17, col 0: `adapter = uri.scheme'
from /usr/local/lib/ruby/1.9.1/syck.rb:135:in `load'
Run Code Online (Sandbox Code Playgroud)
看起来Heroku不喜欢我的database.yml.这是一个概述:
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
production:
adapter: postgresql
encoding: unicode
database: foo
port: 5432
host: foobar.amazonaws.com
username: foo
password: bar
Run Code Online (Sandbox Code Playgroud) 我想在我的S3存储桶中有不同的文件夹,以便从开发环境中清除生产数据库.我不知道如何做到这一点,这是我在carrierwave初始化器中提出的骨架:
if Rails.env.test? or Rails.env.development?
CarrierWave.configure do |config|
//configure dev storage path
end
end
if Rails.production?
CarrierWave.configure do |config|
//configure prod storage path
end
end
Run Code Online (Sandbox Code Playgroud) 我需要将我的Procfile推送到Heroku但我收到此错误:
"Heroku推被拒绝,Bamboo堆栈不支持Procfile"
我正在运行Rails 3.0.9.