Ошибка не позволила сохранить эту статью:
Автор должен существовать
Код моей статьи.rb
сначала я создаю таблицу статей, затем я делаю таблицу авторов, затем я добавляю ссылку на статью
Код моей статьи.rb
class Article < ApplicationRecord
belongs_to :category
belongs_to :author
end
schema.rb
create_table "articles", force: :cascade do |t|
t.string "judul_artikel"
t.text "konten"
t.integer "category_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "authors_id"
t.index ["authors_id"], name: "index_articles_on_authors_id"
t.index ["category_id"], name: "index_articles_on_category_id"
end
create_table "authors", force: :cascade do |t|
t.string "author_name"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "categories", force: :cascade do |t|
t.string "nama_kategori"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
end
Я просто хочу создать статью, но об этом не сообщается. как я могу это исправить?