title: join query works in console but not in view
body: <p>I asked a previous question about how to properly structure my search query, but I find that it only works in console. What I have here is virtually identical to a search method used on another model (the other doesn't use joins), but for some reason this one returns nothing. This one also spits <code>%5B%5D</code> out into the url, whereas the other does not.</p>
  
  <p>The search function in my model:</p>
  
  <pre><code>Class Collection
   def self.search(search)
    if search
     joins(blob: :item).where("items.a ILIKE ?", "%#{search}%")
    else
     order('id DESC')
    end
   end
  end
  </code></pre>
  
  <p>My controller:</p>
  
  <pre><code>@collections = if params[:search]
   current_user.collections.search(params[:search]).order("created_at DESC")
  else
   current_user.collections.order("created_at DESC")
  end
  </code></pre>
  
  <p>And my view:</p>
  
  <pre><code>&lt;%= form_tag collections_path, method: 'get' do %&gt;
   &lt;%= text_field :search, params[:search] %&gt;
  &lt;% end %&gt;
  
  &lt;% @collections.each do |c| %&gt;
   &lt;%= c.item.a %&gt;
   blah blah
  &lt;% end %&gt;
  </code></pre>
  
  <p>The terminal output I get is </p>
  
  <blockquote>
    <p>`SELECT COUNT(*) FROM "collections" INNER
    JOIN "blobs" ON "blobs"."id" = "collections"."blob_id" INNER JOIN
    "items" ON "items"."id" = "blobs"."item_id" WHERE
    "collections"."user_id" = $1 AND (items.a ILIKE '%#{search}%') 
    [["user_id", 1]].</p>
  </blockquote>
  
  <p>Really seems like this should be working, but it's not?</p>