2016-04-23 83 views
0

我試圖用腳手架下面的命令模式:Ruby on Rails的腳手架錯誤

rails generate scaffold Ofertruck title:string country:string city:string lwh:string comment:text postalcode:integer weigth:decimal 

結果我在遷移文件中獲得如下:

class CreateOfertrucks < ActiveRecord::Migration 
    def change 
    create_table :ofertrucks do |t| 
    t.string :title 
    t.string city :country 
    t.decimal :weigth 

    t.timestamps null: false 
    end 
end 
end 

它所產生是錯誤的,它會給出錯誤 bundle exec rake db:migrate

有可能在

處看到
t.string city :country 

爲什麼它會像這樣產生,因爲我確保在每個數據庫列之間放置一個空格?

回答

0

它沒有給我一個錯誤,可能你錯誤​​的地方。

先刪除:

#destroy 

rails d scaffold Ofertruck title:string country:string city:string lwh:string comment:text postalcode:integer weigth:decimal 

試試這個:

# Generate again 

rails g scaffold ofertruck title country city lwh comment:text postalcode:integer weigth:decimal 

# 
+0

謝謝!我用rails g腳手架Ofertruck標題國家城市lwh:字符串評論:文本postalcode:整數weigth:小數,它的工作。 –

+0

@RaduArtene很高興幫助,你能接受答案嗎?謝謝 ! – 7urkm3n