title: How can I filter rows of a model by a certain value?
body: <p>I want to return just the elements that belong to a user. The <code>user_id</code> value is a column from Run. What I want is to select just the <code>runs</code> that are from the <code>current_user</code>.</p>
  
  <pre><code>def index
    @runs = Run.all
  
    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @runs }
    end
  end
  </code></pre>
  
  <p>As tried something like</p>
  
  <pre><code>@runs = Run.where(user_id= =&gt; current_user.id)
  </code></pre>
  
  <p>But it didn't worked. How should I do it?</p>