概要
Rails的にはバリデーション違反なのだが、いちどデータベースにレコードが記録されてしまい、そのまま残っているデータがあるという場合がある
それを見つける方法
単に instance.validate
するだけで良い
コード例
examines テーブルの全てのレコードのバリデーション違反状態を確認する例
Example.all.each do |example|
example.validate
if example.errors.present?
p example.errors.full_messages
end
end
チャットメンバー募集
何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。
プロフィール・経歴