2011-08-18 73 views
0

在最初的幾個Rails應用程序我設置爲小型應用程序來學習我用軌道環境的mixup,開發服務器使用生產DB

RAILS_ENV=production rake db:setup 

,並創建了myapp_production

但是這個(MySQL的)表我無法填充開發或測試數據庫。它只是寫入到生產,也雜種服務器上運行的應用程序寫入到生產數據庫,但說,這是在啓動開發環境:

$ rails server 
WARNING: This version of mysql2 (0.3.6) doesn't ship with the ActiveRecord adapter bundled anymore as it's now part of Rails 3.1 
WARNING: Please use the 0.2.x releases if you plan on using it in Rails <= 3.0.x 
=> Booting WEBrick 
=> Rails 3.0.9 application starting in development on http://0.0.0.0:3000 

我這裏不使用RVM(試過在另一臺電腦,你猜我喜歡)

我不知道如何解決這個問題。並沒有錯誤信息。

+0

你試過運行'rake db:setup RAILS_ENV = development'? – Augusto

+0

什麼是在database.yml開發環境的配置? –

回答

0

您使用舊的Rails版本。 mysql2 gem截至0.3.0不支持rails 3.0及更早版本。所以你需要更新rails到3.1.x或更高版本,或者在Gemfile中使用gem「mysql2」,「〜> 0.2.7」。請參閱mysql2 gem page,在瀏覽器中搜索「3.0」。

也許這就是原因。

相關問題