JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources
undefined method `calculate_page_count' for nil:NilClass
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2.3k
- Forks
- 546
- PR merge metrics
- No merged PRs in 30d
Description
Configuration for JSONAPI http://jsonapi-resources.com/v0.8/guide/configuration.html
JSONAPI.configure do |config|
# :none, :offset, :paged, or a custom paginator name
config.default_paginator = :paged
config.default_page_size = 10
config.maximum_page_size = 50config.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
end
class ContactResource < BaseResource
attributes :name, :email
paginator :none
end
When paginator is set to :none in resource level, Then it shows undefined method `calculate_page_count' for nil:NilClass
if (paginator && JSONAPI.configuration.top_level_meta_include_page_count && record_count)
page_count = paginator.calculate_page_count(record_count)
end
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/jsonapi/processor.rb at the referenced line and reproduce the configuration with a resource using paginator :none and page-count metadata enabled. Confirm the request no longer raises undefined method `calculate_page_count' for nil:NilClass and that the response metadata remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100