title: Duplicate results from Rails search (Railscast #111)
body: <p>I'm getting a weird result when doing a search I've implimented from Railscast #111 (Advanced Search).</p>
  
  <p>The search results are coming through OK from the entries that I have, but when the result is more than 1 (Iv'e only tested for two results) - it doubles the results. So when I expect two results, I get 4 (rendering out in a table).</p>
  
  <p>The weird part is that when I expect 1 result, it only renders the 1 result.</p>
  
  <p>I have a feeling it has something to do with my 'Search.rb' file which gives the search parameters. Can someone else shed some light on why this would be giving duplicate results?</p>
  
  <pre><code>class Search &lt; ActiveRecord::Base
    def entries
      @entries ||= find_entries
    end
  
  private
  
    def find_entries
      entries = Entry.order(:firstname)
      entries = entries.where("firstname like ?", "%#{firstname}%") if firstname.present?
      entries = entries.where("lastname like ?", "%#{lastname}%") if lastname.present?
      entries
    end
  end
  </code></pre>
  
  <p>I am searching by either firstname or lastname, but the entries have more fields in them.</p>