2016-04-23 81 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