Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?

# missingなし Master.left_joins(:datas).where(datas: {id: nil}) # missingあり Master.where.missing(:datas) どういうこと? missingは関連が無いデータを取得するときに使います。例えば 利用されていないマスターデータの一覧を取得する(上例) 所属する社員がいない部署の一覧を取得する(ex: 部署.where.missing(:社員)) 画像が無い記事の一覧を取得する(ex: 記事.where.missing(:画像)) どうやって利用するの? has_one/has_many/belogs_toなどのアソシエーションが組んであれば利用できます。 なにはともあれ、missingって響きがカッコいいので多用したい。 参考
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く