alex@alex-ThinkPad-T410:~/rails_projects/final$ rake db:migrate
rake aborted!
/home/alex/rails_projects/final/db/migrate/20120813025503_add_price_location_and_product_to_microposts.rb:3: syntax error, unexpected ':', expecting ';' or '\n'
add_column :microposts, :price, :text # d...
^
/home/alex/rails_projects/final/db/migrate/20120813025503_add_price_location_and_product_to_microposts.rb:3: syntax error, unexpected ',', expecting tCOLON2 or '[' or '.'
...add_column :microposts, :price, :text # dont forget to chang...
... ^
/home/alex/rails_projects/final/db/migrate/20120813025503_add_price_location_and_product_to_microposts.rb:7: syntax error, unexpected keyword_end, expecting $end
这就是错误。这是迁移(下)
class AddPriceLocationAndProductToMicroposts < ActiveRecord::Migration
def
add_column :microposts, :price, :text
add_column :microposts, :location, :text
add_column :microposts, :product, :text
end
end
我是考虑到这一点而写的http://guides.rubyonrails.org/migrations.html#chang-migrations教派。2.2
为什么要分号?我正在尝试将价格、位置、产品列添加到 microposts 表