title: How to select by id and display in view?
body: <p>I have a brands table in the database. What I want to do is select a few rows by ID and display them in the view. </p>
  
  <p>This is what I have, but I can't get the <strong>Brand.find_by(id: [1,2,3])</strong> to work.</p>
  
  <p>Any help is appreciated, thanks!</p>
  
  <p>In the brand.rb Model:</p>
  
  <pre><code>class Brand &lt; ActiveRecord::Base
  
  def selection
      Brand.find_by(id: [1,2,3])
  end
  </code></pre>
  
  <p>in the brands/index.html.erb view</p>
  
  <pre><code>&lt;% @brand.selection.each do |brand| %&gt;
  &lt;%= link_to brand.name, brand %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>in the controller </p>
  
  <pre><code>class BrandsController &lt; ApplicationController
  def index
      @brands = Brand.all
  end
  
  def show
    @brand = Brand.find(params[:id])
    @review = Review.find(params[:id])
  end
  
  def new
    @brand = Brand.new
  end
  
  def create
    @brand = Brand.new(review_params)
  end
  
  end
  </code></pre>