Próbuję utworzyć nowy stół w szynach. Każdy przykład znaleźć i spróbować niestety nie działa ze mną ... więc to, co starałem dotąd: (używam Ruby i Rails wersja 1.9 Wersja 3.2.13 tworzenia nowego modelu w terminalu:Utwórz nowy stół w rubinach na szynach
rails generate model content content_id:auto-generated, law_id:integer, parent_id:integer, titel:string, text:string, content:string, url:string
że wygenerowany następujący kod:
class CreateContents < ActiveRecord::Migration
def change
create_table :contents do |t|
t.auto-generated, :content_id
t.integer, :law_id
t.integer, :parent_id
t.string, :titel
t.string, :text
t.string, :content
t.string :url
t.timestamps
end
end
end
jeśli próbuję rake db: migrować pojawia się następujący komunikat o błędzie:
syntax error, unexpected ',', expecting keyword_end
t.auto-generated, :content_id
^
jeśli usunąć "" mam to Komunikat o błędzie:
syntax error, unexpected tSYMBEG, expecting keyword_do or '{' or '('
t.auto-generated :content_id
^
moje badania mnie do również do tego sposobu tworzenia tabeli:
class CreateContents < ActiveRecord::Migration
def change
create_table :contents do |t|
t.auto-generated "content_id"
t.integer "law_id"
t.integer "parent_id"
t.string "titel"
t.string "text"
t.string "content"
t.string "url"
t.timestamps
end
end
end
jeśli próbuję rake db z tego przykładu i ten komunikat o błędzie:
syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '('
t.auto-generated "content_id"
^
Co mam zrobić źle?
dziękuję, podstęp! – Eumundi