undefined method `calculate_page_count' for nil:NilClass
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
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.
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
- Dominant language
- Ruby
- Stars
- 2.3k
- Forks
- 546
- PR merge metrics
- No merged PRs in 30d
Getting set up
We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.
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.
More from JSONAPI-Resources/jsonapi-resources
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 3/5 1-2 days Newbie friendliness 50/100
JSONAPI-Resources/jsonapi-resources#1488 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 42/100
JSONAPI-Resources/jsonapi-resources#1479 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
JSONAPI-Resources/jsonapi-resources#1477 · 3 comments · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
All issues in JSONAPI-Resources/jsonapi-resources
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
TheOdinProject/curriculum#31423 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
oxidize-rb/rb-sys#807 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day