2021-05-23から1日間の記事一覧
14章 フォローとフォロワーの関係がややこしいのでまとめる ユーザーモデル内 class User < ApplicationRecord has_many :microposts, dependent: :destroy has_many :active_relationships, class_name: "Relationship", foreign_key: "follower_id", depen…
今回は13章をやっていく中で必要だと思ったところをメモしていきます。 ・複合キーインデックス micropostのマイグレーションファイル class CreateMicroposts < ActiveRecord::Migration[6.0] def change create_table :microposts do |t| t.text :content …