<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>shinshin86</author_name>
  <author_url>https://blog.hatena.ne.jp/shinshin86/</author_url>
  <blog_title>at backyard</blog_title>
  <blog_url>https://shinshin86.hateblo.jp/</blog_url>
  <categories>
    <anon>Ruby</anon>
    <anon>Ruby on Rails</anon>
    <anon>備忘録</anon>
    <anon>API</anon>
  </categories>
  <description>Railsのrender jsonを用いて、複数テーブルのjsonデータを返す方法。調べてもぱっと出てこなかったので、一応メモとしておく。 (そもそも常識なのかもしれない) そのため、あくまで個人的な備忘録の意味が強い。最近RailsでAPIを作っているのだが、&quot;render json&quot;で複数の関連テーブルを １つのjsonとして返したかったので、そのやり方をメモ。&quot;posts&quot;というテーブルに関連する&quot;comments&quot;と&quot;images&quot;データも一緒に返したいときは、 下記のようにrenderメソッドに記載する。 (&quot;@posts&quot;にはpostsデータが入っているものとする。 respond…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fshinshin86.hateblo.jp%2Fentry%2F2017%2F08%2F17%2F063254&quot; title=&quot;Railsで複数テーブルのjsonデータを一度に返したい。 - at backyard&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>2017-08-17 06:32:54</published>
  <title>Railsで複数テーブルのjsonデータを一度に返したい。</title>
  <type>rich</type>
  <url>https://shinshin86.hateblo.jp/entry/2017/08/17/063254</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
