title: Restrict Index View to User's Records
body: <p>I'm working on a Ruby project and running into a roadblock.  It's a simple thing, but I keep running into errors so I'm turning to SO for help.</p>
  
  <p>I need to restrict a view to records created by a particular user.  In this case, a supplier's orders. Here's my current index controller (using will_paginate gem to limit to 30 per page):</p>
  
  <pre><code>class OrdersController &lt; ApplicationController
    before_action :set_order, only: [:show, :edit, :update, :destroy]
    before_filter :authenticate_supplier!
  
    def index
      @orders = Order.all.order("created_at DESC").paginate(:page =&gt; params[:page], :per_page =&gt; 30)
    end
  </code></pre>
  
  <p>Right now, ALL orders show rather than the desired - only orders put in by the particular supplier should show in the index.  I attempted to use something along these lines, but no luck:</p>
  
  <pre><code>def index
   @orders = Order.current_supplier.order("created_at DESC").paginate(:page =&gt; params[:page], :per_page =&gt; 30)
  end
  </code></pre>
  
  <p>Using devise for suppliers.  </p>