app/helpers/helpers.rb
def end_paginate! results
      # set the link headers
      link = ""
      link += "<#{@next_page}>; rel=\"next\"" unless results.empty? or results.count < @limit
      headers['X-Next-Page'] = @next_page unless results.empty? or results.count < @limit
      if not results.empty? and @page > 1
        link += ", "
      end
      link += "<#{@prev_page}>; rel=\"prev\"" unless @page == 1
      headers['X-Prev-Page'] = @prev_page unless @page == 1
      headers['Link'] = link
      headers['X-Total-Count'] = @count.to_s
    end
# sets the response headers Link and X-Total-Count based on the results
sets the response headers Link and X-Total-Count based on the results
sets the response headers Link and X - Total - Count based on the results
def end_paginate! results
      link = ""
      link += "<#{@next_page}>; rel=\"next\"" unless results.empty? or results.count < @limit
      headers['X-Next-Page'] = @next_page unless results.empty? or results.count < @limit
      if not results.empty? and @page > 1
        link += ", "
      end
      link += "<#{@prev_page}>; rel=\"prev\"" unless @page == 1
      headers['X-Prev-Page'] = @prev_page unless @page == 1
      headers['Link'] = link
      headers['X-Total-Count'] = @count.to_s
    end
def end_paginate! results link = "" link += "<#{@next_page}>; rel=\"next\"" unless results . empty? or results . count < @limit headers [ 'X-Next-Page' ] = @next_page unless results . empty? or results . count < @limit if not results . empty? and @page > 1 link += ", " end link += "<#{@prev_page}>; rel=\"prev\"" unless @page == 1 headers [ 'X-Prev-Page' ] = @prev_page unless @page == 1 headers [ 'Link' ] = link headers [ 'X-Total-Count' ] = @count . to_s end
sets the response headers Link and X-Total-Count based on the results
sets the response headers Link and X - Total - Count based on the results
# set the link headers
results