2012-02-24 18 views
8

我正試圖用rails在ruby中創建一個簡單的應用程序。我創造了這個支架:爲什麼數據庫遷移在rails中出現blob數據類型時失敗?

rails generate scaffold Pic title:string content:blob description:text 

,當我嘗試遷移分貝rake db:migrate我得到這個錯誤:

rake aborted! 
An error has occurred, this and all later migrations canceled: 

undefined method `blob' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0xb74f8ec4> 

當我寫說的text代替blob它正常工作。那麼blob有什麼問題?

回答

13

該關鍵字是二進制的,而不是blob。

rails generate scaffold Pic title:string content:binary description:text 
2

在rails中沒有關鍵字blob,你需要二進制。

rails generate scaffold Pic title:string content:binary description:text 
相關問題