<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>madogiwa0124</author_name>
  <author_url>https://blog.hatena.ne.jp/madogiwa0124/</author_url>
  <blog_title>Madogiwa Blog</blog_title>
  <blog_url>https://madogiwa0124.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby on Rails</anon>
  </categories>
  <description>自分の投稿とフォローしているユーザの投稿をトップページで表示したかったけど、RailsでどうやってSQLのIN句のような形の条件指定でハマったので、メモ。 指定したかった条件 下記を含んだ投稿の取得 自分自身の投稿 フォローしているユーザーの投稿 対応方法 Model.find(カラム名: 配列)を使えばOK 実際のコード def self.followed_users_and_my_topics(current_user) # フォロー済ユーザーのidの取得 followed_ids = current_user.followed_users.map{ |user| user.id } # …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmadogiwa0124.hatenablog.com%2Fentry%2F2017%2F06%2F04%2F131401&quot; title=&quot;RubyonRails:IN句を使った取得条件の指定(自分とフォロー済ユーザーの投稿取得)について - Madogiwa Blog&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-06-04 13:14:01</published>
  <title>RubyonRails:IN句を使った取得条件の指定(自分とフォロー済ユーザーの投稿取得)について</title>
  <type>rich</type>
  <url>https://madogiwa0124.hatenablog.com/entry/2017/06/04/131401</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
