2021-06-21から1日間の記事一覧
社内ドキュメントに書いたものの転載。 前提 猫と猫の脚というモデルがあり、猫は脚が一本以上は必要というバリデーションがされているとき、 class Cat < ApplicationRecord has_many :cat_legs, dependent: :destroy validates :cat_legs, presence: true …
社内ドキュメントに書いたものの転載。 前提 猫と猫の脚というモデルがあり、猫は脚が一本以上は必要というバリデーションがされているとき、 class Cat < ApplicationRecord has_many :cat_legs, dependent: :destroy validates :cat_legs, presence: true …