<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>xoyip</author_name>
  <author_url>https://blog.hatena.ne.jp/xoyip/</author_url>
  <blog_title>ぴよログ</blog_title>
  <blog_url>https://xoyip.hatenablog.com/</blog_url>
  <categories>
    <anon>ActiveRecord</anon>
    <anon>Rails</anon>
    <anon>gem</anon>
    <anon>peper_trail</anon>
  </categories>
  <description>RailsでA、Bというモデルがあるとする。モデルAはモデルBを参照しているが、参照しているモデルBはある瞬間のスナップショットにしたいとする。つまり、モデルAが欲しいのは関連を作ったときのモデルBの情報で、それ以降に変更が加わって新しくなったものではないということだ。 例として不適切かもしれないが、モデルAをお気に入りモデル、モデルBをツイートとしてみる。あるユーザーがあるツイートをお気に入りに登録すると、お気に入りモデルが新しく作られる。 擬似コードはこんな感じ。 p @tweet.body # =&gt; &quot;今日は雨でした&quot; @fav = @user.favorites.create(twee…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fxoyip.hatenablog.com%2Fentry%2F2014%2F07%2F16%2F203000&quot; title=&quot;Railsである時点でのモデルのスナップショットのためにpaper_trailでのバージョニングを行う - ぴよログ&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>http://hatenablog.com/images/theme/og-image-1500.gif</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2014-07-16 20:30:00</published>
  <title>Railsである時点でのモデルのスナップショットのためにpaper_trailでのバージョニングを行う</title>
  <type>rich</type>
  <url>https://xoyip.hatenablog.com/entry/2014/07/16/203000</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
