0
這很奇怪。我一定會指定適配器,它甚至會在rake任務的頂部行中輸出puts
。 db:migrate也可以。ActiveRecord配置沒有在db上指定適配器:create
$ rake db:create
{"adapter"=>"mysql2", "encoding"=>"utf8", "reconnect"=>false, "database"=>"craigslist_development", "pool"=>5, "username"=>"root", "password"=>"splitzo", "host"=>"localhost"}
rake aborted!
database configuration does not specify adapter
有什麼想法?
讓我知道你是否需要更多信息。
UPDATE:
我相信環境是正確設置它,當我運行耙分貝的工作原理:遷移
我注意到它正在運行的ActiveRecord的establish_connection兩次,第二它沒有得到散列。我加了一些調試代碼
,我得到這個:
{"adapter"=>"mysql2", "encoding"=>"utf8", "reconnect"=>false, "database"=>"appname_development", "pool"=>5, "username"=>"user", "password"=>"password", "host"=>"localhost"} (just prints hash object)
test:true (first time)
test:false (second time)
rake aborted!
database configuration does not specify adapter
它本質上只是這一點,因爲它與其他任務的工作我假設的格式是良好的,沒有奇怪的空白問題等:
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: appname_development
pool: 5
username: user
password: password
host: localhost
它必須是我的Rakefile中的邏輯問題?
你有沒有指定要使用哪個RAILS_ENV? –
你可以發佈你的database.yml嗎? –