I have the following migration:
rails g migration CreateJoinTableQuestionTag question tag
class CreateJoinTableQuestionTag < ActiveRecord::Migration
def change
create_join_table :questions, :tags do |t|
t.index [:question_id, :tag_id]
t.index [:tag_id, :question_id]
end
end
end
When i run rake:db:migrate it creates this in schema.rb:
create_table "questions_tags", id: false, force: :cascade do |t|
t.integer "question_id", null: false
t.integer "tag_id", null: false
end
add_index "questions_tags", ["question_id", "tag_id"], name: "index_questions_tags_on_question_id_and_tag_id"
add_index "questions_tags", ["tag_id", "question_id"], name: "index_questions_tags_on_tag_id_and_question_id"
In the comand line:
QuestionTag.first
QuestionTag Load (0.9ms) SELECT "question_tags".* FROM "question_tags" ORDER BY "question_tags"."id" ASC LIMIT 1
SQLite3::SQLException: no such table: question_tags: SELECT "question_tags".* FROM "question_tags" ORDER BY "question_tags"."id" ASC LIMIT 1
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: question_tags: SELECT
Shouldn't this migration create a question_tags table instead of questions_tags?