2019-10-12から1日間の記事一覧
自己結合 自己テーブルを参照する関連も作ることができる class AddColumnToPosts < ActiveRecord::Migration[6.0] def change add_reference :posts, :prev_post add_reference :posts, :next_post end end class Post < ApplicationRecord belongs_to :cat…
自己結合 自己テーブルを参照する関連も作ることができる class AddColumnToPosts < ActiveRecord::Migration[6.0] def change add_reference :posts, :prev_post add_reference :posts, :next_post end end class Post < ApplicationRecord belongs_to :cat…