title: page shows all the records for the first time before pagination
body: <p><strong>Problem Description:</strong></p>
  
  <p>We have a ROR application which is making a call to the external system and displaying the results on the page. But when it displays the results for the first time it shows all the rows returned from the external system,for ex 2000 records, and then it refreshes by itself to show the first 10 records.</p>
  
  <p>here is the code:</p>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>  def index
      @filter_options = {
        "My Accounts" =&gt; "my",
        "My Team's Accounts" =&gt; "team"
      }
  
      @selected_filter = params[:selectedfilter] || "my"
  
      @accounts = Account.index as: current_portal_user, filter: @selected_filter
    end
  </code></pre>
  
  <p><strong>Model class</strong>:</p>
  
  <pre><code>  def self.index options = {}
      user = options[:as]
      role = user.role
      contact_id = user.contact_id
      account_id = user.account_id
  
      query_string = if options[:filter].nil?
        Account.get_all_accounts(account_id, contact_id, role)
      elsif options[:filter] == "team"
        Account.get_myteams_accounts(account_id, contact_id, role)
      elsif options[:filter] == "my"
        Account.get_my_accounts(account_id, contact_id, role)
      elsif options[:filter] == "id"
        self.index_basic_query + "WHERE Id = '#{options[:id]}'"
      end
  
          more_results.uniq { |acc| acc.Id }
     end
  </code></pre>
  
  <p>Can some body please tell me why the page is showing all the records of the query for a fraction of second and then refreshes by itself to show the first ten records.</p>
  
  <p><strong>Note:</strong> I am completely new to Ruby and ROR and trying my best to fix this problem. The code I posted above is pseudo code so please bear with me if there is any syntax error or as such.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p><strong>GOAL:</strong>
  When the results for the query are shown on the page, first it shows all the records from the resultset before doing the pagination.
  For ex: I open the page and select the filter and click on 'go' button and for the filter I selected I am expecting 2000 records. So what is happening is page shows all the 2000 records and then within fraction of a second, it refreshes and then shows the first 10 records of the total 2000 resultset.</p>
  
  <p>Thanks in Advance.</p>