Sha256: 99138c48a1cf9dae1e85b8cd6f1ed2a23a9fbdd89f5a93620ec358197dbe845f

Contents?: true

Size: 497 Bytes

Versions: 4

Compression:

Stored size: 497 Bytes

Contents

# frozen_string_literal: true

require_relative './current_page_for_helper'
require_relative './page_size_for_helper'

module Pagination
  module RecordFirstForHelper
    include Pagination::CurrentPageForHelper
    include Pagination::PageSizeForHelper

    def pagination_record_first_for(set)
      current_page = pagination_current_page_for(set)
      page_size = pagination_page_size_for(set)

      return 1 if current_page == 1

      ((current_page - 1) * page_size) + 1
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
actionset-0.11.0 lib/action_set/helpers/pagination/record_first_for_helper.rb
actionset-0.10.0 lib/action_set/helpers/pagination/record_first_for_helper.rb
actionset-0.9.2 lib/action_set/helpers/pagination/record_first_for_helper.rb
actionset-0.9.1 lib/action_set/helpers/pagination/record_first_for_helper.rb