There's a Team table in my project. I've made a migration that is supposed to create table Match using the command below:
rails generate model Match Team:references Team:re
ferences score1:integer score2:integer date:datetime length:integer place:string
I want my Matches table to contain 2 foreign keys (team1, team2) referencing same column (id) on Teams table. I'm pretty sure I did this wrong, because in schema.rb there's:
create_table "matchs", force: true do |t|
t.integer "Team_id"
t.integer "score1"
t.integer "score2"
t.datetime "date"
t.integer "length"
t.string "place"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "matchs", ["Team_id"], name: "index_matchs_on_Team_id"
and I can't see 2nd Team_id. What is the proper way to do what I need?