title: Rails link_to index with variable
body: <p>I have this index action in my collections_controller</p>
  
  <pre><code>def index
      @user = User.find(params[:user_id])
      @collections = @user.collections(:status).paginate(page: params[:page])
    end
  </code></pre>
  
  <p>I have these two links on my home page</p>
  
  <pre><code>&lt;%= user_collections_path(@user, :status =&gt; "Got") %&gt;"&gt;collection&lt;/a&gt;
  &lt;%= user_collections_path(@user, :status =&gt; "Want") %&gt;"&gt;wantlist&lt;/a&gt;
  </code></pre>
  
  <p>The idea is they will link to this index page</p>
  
  <pre><code>&lt;% provide(:title, @user.name ) %&gt;
  &lt;h1&gt;&lt;% if current_user?(@user) %&gt;Your&lt;% else %&gt;
      &lt;%= @user.name %&gt;'s&lt;% end %&gt; collection&lt;/h1&gt;
  
  &lt;%= will_paginate %&gt;
  
  &lt;ul class="users"&gt;
    &lt;%= render @collections %&gt;
  &lt;/ul&gt;
  
  &lt;%= will_paginate %&gt;
  </code></pre>
  
  <p>which in turn loads this partial</p>
  
  <pre><code>&lt;li&gt;
    &lt;%= image_tag collection.photo.url(:icon), :retina =&gt; true %&gt;
  
    &lt;%= link_to collection.miniature.name, collection %&gt;
    &lt;%= collection.progress %&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>Polulating it with either the user collections marked as "Got" or the user collections marked as "Want" depending on which link is clicked.</p>
  
  <p>Currently the index is loading ALL of a user's collections. Albeit at paths which look right to me (e.g. /users/1/collections?status=Got)</p>
  
  <p>I assume the fault is with this line in the controller  <code>@collections = @user.collections(:status).paginate(page: params[:page])</code></p>
  
  <p>Instead of (:status) do I need something like <code>@user.collections.where(:status = "?")</code> perhaps?</p>
  
  <p>Any help much appreciated.</p>