mercredi 5 juin 2019

rails syntax error when add column to model

I am trying to build a music app with rails where I encountered error, just wondering does anyone know what it means?

when I did rails g migration add_quantity_to_line_items quantity:integer, default: 1

rails db:migrate

which threw back rails aborted! SyntaxError: /Users/Code/Ruby/musicapp/db/migrate/20190605091214_add_quantity_to_line_items.rb:4: syntax error, unexpected tSYMBEG, expecting do or '{' or '(' add_column :line_items, :default, :string ^ /Users/mrswordsmith/Code/Ruby/musicapp/db/migrate/20190605091214_add_quantity_to_line_items.rb:5: syntax error, unexpected tINTEGER, expecting tSTRING_CONTENT or tSTRING_DBEG or tSTRING_DVAR or tSTRING_END add_column :line_items, :1, :string

class AddQuantityToLineItems < ActiveRecord::Migration[5.2]
  def change
    add_column :line_items, :quantity, :integer,
    add_column :line_items, :default, :string
    add_column :line_items, :1, :string
  end
end

Aucun commentaire:

Enregistrer un commentaire