<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>dogwood008</author_name>
  <author_url>https://blog.hatena.ne.jp/dogwood008/</author_url>
  <blog_title>dogwood008の開発メモ！</blog_title>
  <blog_url>https://blog.dogwood008.com/</blog_url>
  <categories>
    <anon>Active Record</anon>
    <anon>Ruby on Rails</anon>
    <anon>Ruby</anon>
  </categories>
  <description>例えば、「特定の条件を持つユーザIDだけ欲しい」といった場合に有効。この時、 pluck を使うと戻り値は Array で、 select を使うと ActiveRecord::Relation が返る。 この時、 map を使うのは無駄なメモリを食ったり動作が遅くなったりするので、やってはいけない。 # このようなUserモデルがあるとする User.where('created_at &gt;= ?', Time.zone.yesterday) # =&gt; #&lt;ActiveRecord::Relation [&lt;#User id: xxx, ...&gt;, &lt;#User id: xxx, ...&gt;, .…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fblog.dogwood008.com%2Fentry%2Fselect-or-pluck&quot; title=&quot;【Rails/ActiveRecord】特定のカラムの情報だけ欲しい場合は、pluckかselectを使う - dogwood008の開発メモ！&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>2022-05-17 22:35:36</published>
  <title>【Rails/ActiveRecord】特定のカラムの情報だけ欲しい場合は、pluckかselectを使う</title>
  <type>rich</type>
  <url>https://blog.dogwood008.com/entry/select-or-pluck</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
