<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>ichiro_tanaka</author_name>
  <author_url>https://blog.hatena.ne.jp/ichiro_tanaka/</author_url>
  <blog_title>タナカイチロウの日記</blog_title>
  <blog_url>https://ichiro-tanaka.hatenadiary.org/</blog_url>
  <categories>
    <anon>Rails</anon>
    <anon>Ruby</anon>
    <anon>ActiveRecord</anon>
  </categories>
  <description>ARのfindをある条件で絞っておきたい場合。with_scopeが使える。Rails2.1以降？にはnamed_scopeというのもあるらしいけど、今回はRails1.2で。例えばARの論理削除プラグイン、acts_as_paranoidではdeleted_atに削除フラグを立てる。通常のfindでは削除フラグが立ってるレコードは読まないようにAliasされており、あえて削除レコードをfindしたいときはfind_with_deleted（＝オリジナルのfind）を呼べばいい。など。acts_as_paranoidのように、モデル側で常に条件を絞っておく場合、たとえばsakuraカラムがNU…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fichiro-tanaka.hatenadiary.org%2Fentry%2F20090210%2F1234234223&quot; title=&quot;ActiveRecord::Base#with_scopeとscoped_access - タナカイチロウの日記&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>2009-02-10 11:50:23</published>
  <title>ActiveRecord::Base#with_scopeとscoped_access</title>
  <type>rich</type>
  <url>https://ichiro-tanaka.hatenadiary.org/entry/20090210/1234234223</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
