2021-05-12から1日間の記事一覧
著者(author)と書籍(book)の1対多の関係があった場合、モデルは次のようになります。 class Author < ApplicationRecord has_many :books end class Book < ApplicationRecord belongs_to :author end Bookは次のカラムを持っています。 name:string author_…
著者(author)と書籍(book)の1対多の関係があった場合、モデルは次のようになります。 class Author < ApplicationRecord has_many :books end class Book < ApplicationRecord belongs_to :author end Bookは次のカラムを持っています。 name:string author_…