title: Error with 2 pagination's on same Webpage
body: <p>I am not a ruby on rails programmer but i have gotten quite far with adding a second results table to my page.</p>
  
  <p>the problem that i have is that the Pagination is messed up. </p>
  
  <p>When it is first loaded. everything looks right. but when you click on another page number it changes the page on second table as well. plus adds a copy of the second table as like a 3rd table to the page.</p>
  
  <p>i have screan shots.</p>
  
  <p><strong>Original page loads</strong><br>
  <a href="http://www.digihaul.com/1.png" rel="nofollow noreferrer">Orignial when page loads http://www.digihaul.com/1.png</a></p>
  
  <p><strong>Once a page is selected</strong>  </p>
  
  <h1><a href="http://www.digihaul.com/2.png" rel="nofollow noreferrer">Once a page is selected http://www.digihaul.com/2.png</a></h1>
  
  <p>here is my View</p>
  
  <pre><code>.row-fluid#load_results_table
    .span12
      - if resultss.empty?
        =render partial: 'no_results', locals: {search: search}
      - else
        %h1.page-header Premium Loads
        %p= "These are our loads we are offering. We guarentee 100% payment on these loads"
      %table.table.search_results.table-condensed.table-bordered.table-striped.sortable{:id =&gt; "#{searches.search_type.pluralize}"}
        %thead
          %tr.search_header
            %th= sortable_load "origin"
            %th= sortable_load "dest"
            %th= sortable_load "pickup"
            %th= sortable_load "delivery"
            %th= sortable_load "ltl"
            %th= sortable_load "equipment_id", "Equipment"
            %th= sortable_load "weight"
            %th= sortable_load "length"
            %th= sortable_load "rate"
            -unless @searches.origin.blank?
              %th Estimated Deadhead Miles
            %th Actions
        %tbody
          - resultss.each do |result|
            %tr{:class =&gt; "#{searches.search_type}_view", :id =&gt; "#{result['id']}" }
              %td= Location.to_cs(result.origin)
              %td= Location.to_cs(result.dest)
              %td= format_date(result.pickup)
              %td= format_date(result.delivery)
              %td= full_or_par(result.ltl)
              %td= result.equipment_id ? Equipment.to_equipment_name(result.equipment_id) : ""
              %td= result.weight
              %td= result.length
              %td= result.rate
              -unless @searches.origin.blank?
                %td= Location.distance_between(@searches.origin.coords, result['origin'])
              %td
                .btn-group
                  %a.btn.btn-info{ :href =&gt; "/#{searches.search_type.pluralize}/#{result['id']}" } Show
                  %a.btn{ :href =&gt; "javascript:void(0)", :class =&gt; "save", user_id: @searches.user_id, :id =&gt; result['id']} Save
                  %a.btn.btn-primary{ :href =&gt; "javascript:void(0)", :class =&gt; "cover_link", :user_id=&gt; @searches.user_id } Cover 
      = will_paginate resultss, :renderer =&gt; BootstrapPagination::Rails
  .row-fluid#load_results_table
    .span12
      - if results.empty?
        =render partial: 'no_results', locals: {search: search}
      - else
        %h1.page-header Search Results
        - if results.count &gt; 1000
          %p= "Your search yielded many #{search.search_type.pluralize}"
        - else
          %p= "Your search yielded #{results.count} #{search.search_type.pluralize}"
        =render partial: 'header_buttons', locals: {search: search}
        %br
        = will_paginate results, :renderer =&gt; BootstrapPagination::Rails, id: "first_pagination"
        %table.table.search_results.table-condensed.table-bordered.table-striped.sortable{:id =&gt; "#{search.search_type.pluralize}"}
          %thead
            %tr.search_header
              %th= sortable_load "origin"
              %th= sortable_load "dest"
              %th= sortable_load "pickup"
              %th= sortable_load "delivery"
              %th= sortable_load "ltl"
              %th= sortable_load "equipment_id", "Equipment"
              %th= sortable_load "weight"
              %th= sortable_load "length"
              %th= sortable_load "rate"
              -unless @search.origin.blank?
                %th Estimated Deadhead Miles
              %th Actions
          %tbody
            - results.each do |result|
              %tr{:class =&gt; "#{search.search_type}_view", :id =&gt; "#{result['id']}" }
                %td= Location.to_cs(result.origin)
                %td= Location.to_cs(result.dest)
                %td= format_date(result.pickup)
                %td= format_date(result.delivery)
                %td= full_or_par(result.ltl)
                %td= result.equipment_id ? Equipment.to_equipment_name(result.equipment_id) : ""
                %td= result.weight
                %td= result.length
                %td= result.rate
                -unless @search.origin.blank?
                  %td= Location.distance_between(@search.origin.coords, result['origin'])
                %td
                  .btn-group
                    %a.btn.btn-info{ :href =&gt; "/#{search.search_type.pluralize}/#{result['id']}" } Show
                    %a.btn{ :href =&gt; "javascript:void(0)", :class =&gt; "save", user_id: @search.user_id, :id =&gt; result['id']} Save
                    %a.btn.btn-primary{ :href =&gt; "javascript:void(0)", :class =&gt; "cover_link", :user_id=&gt; @search.user_id } Cover 
        = will_paginate results, :renderer =&gt; BootstrapPagination::Rails
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>  def show
      @search = Search.find(params[:id])
      @searches = Search.find(params[:id])
      @results = @search.search(params[:page])
      @resultss = @searches.searches(params[:page])
      @search.update_attribute(:results, @results.count)
      @searches.update_attribute(:resultss, @resultss.count)
      respond_to do |format|
        format.html 
        format.js {render "results"}
        format.js {render "resultss"}
      end
    end
  </code></pre>
  
  <p>Model (minimized the query)</p>
  
  <pre><code>  def search(page)
      where = []
      where &lt;&lt; PrepareSearch.states("dest", self.dest_states) unless self.dest_states.blank?
      if self.search_type == 'load'
        select = "loads.id, origin, dest, pickup, delivery, ltl, equipment_id, weight, length, rate"
        where &lt;&lt; PrepareSearch.date('pickup', self.pickup, self.pickup_operator) unless self.pickup.blank?
      elsif self.search_type == 'truck'
        select = "trucks.id, origin, dest, available, expiration, equipment_id, comments"
        where &lt;&lt; PrepareSearch.date('available',self.available,self.available_operator) unless self.available.blank?
      end
      where = where.join(' AND ')
      order = self.order_by ? self.order_by + " desc" : ""
      limit = "LIMIT=200"
        Module.const_get(self.search_type.capitalize).where(where).select(select).limit(limit).order(order).page(page).per_page(20)
    end
  
  
    def searches(page)
      where = []
      where &lt;&lt; PrepareSearch.states("dest", self.dest_states) unless self.dest_states.blank?
      if self.search_type == 'load'
        select = "loads.id, origin, dest, pickup, delivery, ltl, equipment_id, weight, length, rate"
        where &lt;&lt; PrepareSearch.date('pickup', self.pickup, self.pickup_operator) unless self.pickup.blank?
      elsif self.search_type == 'truck'
        select = "trucks.id, origin, dest, available, expiration, equipment_id, comments"
        where &lt;&lt; PrepareSearch.date('available',self.available,self.available_operator) unless self.available.blank?
      end
      where = where.join(' AND ')
      order = self.order_by ? self.order_by + " desc" : ""
      limit = "LIMIT=200"
        Hotload.where(where).select(select).limit(limit).order(order).page(page).per_page(5)
    end
  </code></pre>