<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>shinkufencer</author_name>
  <author_url>https://blog.hatena.ne.jp/shinkufencer/</author_url>
  <blog_title>コード日進月歩</blog_title>
  <blog_url>https://shinkufencer.hateblo.jp/</blog_url>
  <categories>
    <anon>雑記</anon>
  </categories>
  <description>初学者にいい感じに説明できなかったので、SQLの概念抜きにしてまとめてみる 用途ベースの使い分け方 いずれもModel（ActiveRecord）からデータを取得するために使うものだが まずは大きく2つのうちどちらかになるかを考える 結果が単一になるものを取りたい 結果が複数になるものを取りたい Aの場合、どのように絞り込みたいかによって代わり サロゲートキーであるID 複合した条件 の2つで分かれる。この結果を持って A1が find A2が find_by Bが where といういずれかの選択になる。 また、whereに関しては直接モデルのクラスではなく ActiveRecord::Re…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fshinkufencer.hateblo.jp%2Fentry%2F2019%2F10%2F06%2F000000&quot; title=&quot;ActiveRecordの find , find_by , where の使い分け - コード日進月歩&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2019-10-06 00:00:00</published>
  <title>ActiveRecordの find , find_by , where の使い分け</title>
  <type>rich</type>
  <url>https://shinkufencer.hateblo.jp/entry/2019/10/06/000000</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
