<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>sinsoku</author_name>
  <author_url>https://blog.hatena.ne.jp/sinsoku/</author_url>
  <blog_title>アジャイルSEを目指すブログ</blog_title>
  <blog_url>https://sinsoku.hatenadiary.org/</blog_url>
  <categories>
    <anon>Ruby</anon>
    <anon>Rails</anon>
  </categories>
  <description>DBの論理削除*1を使う場合、default_scopeを使うと便利。 論理削除ではないが、簡単な例を下記に書いておく。 default_scope default_scopeをこのように定義しておく。 class Book &lt; ActiveRecord:Base default_scope where(:R18 =&gt; false) end すると、 Book.create(:title =&gt; &quot;コミック快楽天 2011年 07月号&quot;, :price =&gt; 380, :R18 =&gt; true) Book.all # =&gt; [] R18な本はallで出なくなります。 unscoped 一覧を出し…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fsinsoku.hatenadiary.org%2Fentry%2F20110620%2F1308496688&quot; title=&quot; railsのdefault_scopeとunscoped - アジャイルSEを目指すブログ&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>2011-06-20 00:18:08</published>
  <title> railsのdefault_scopeとunscoped</title>
  <type>rich</type>
  <url>https://sinsoku.hatenadiary.org/entry/20110620/1308496688</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
