Skip to content

Commit

Permalink
adjust type casting and add to README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Freeman committed Apr 21, 2018
1 parent fda9d58 commit dd817cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,9 @@ JSONAPI.configure do |config|
config.top_level_meta_include_record_count = true
config.top_level_meta_record_count_key = :record_count

config.top_level_meta_include_page_count = true
config.top_level_meta_page_count_key = :page_count

config.use_text_errors = false

config.exception_class_whitelist = []
Expand Down
6 changes: 3 additions & 3 deletions lib/jsonapi/utils/support/pagination.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ def count_records(records, options)
def page_count_for(record_count)
return 0 if record_count.to_i < 1

size = page_params['size'] || page_params['limit']
size = JSONAPI.configuration.default_page_size unless size.to_i.nonzero?
(record_count.to_f / size.to_i).ceil
size = (page_params['size'] || page_params['limit']).to_i
size = JSONAPI.configuration.default_page_size unless size.nonzero?
(record_count.to_f / size).ceil
end

# Count records from the datatase applying the given request filters
Expand Down

0 comments on commit dd817cb

Please sign in to comment.