-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable pagination links via config #1917
Conversation
7241ce5
to
adba526
Compare
@@ -52,6 +52,8 @@ def json_key | |||
# rubocop:enable Metrics/CyclomaticComplexity | |||
|
|||
def paginated? | |||
return false unless Serializer.config.jsonapi_pagination_links_enabled | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or just ActiveModelSerializers.config.jsonapi_pagination_links_enabled &&
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed 👍
adba526
to
55fe981
Compare
@@ -52,7 +52,8 @@ def json_key | |||
# rubocop:enable Metrics/CyclomaticComplexity | |||
|
|||
def paginated? | |||
object.respond_to?(:current_page) && | |||
Serializer.config.jsonapi_pagination_links_enabled && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/Serializer/ActiveModelSerializers
. the Serializer is no longer the primary object..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did not realize this, thank you. Changed.
55fe981
to
19b5abf
Compare
@richmolj You wanna merge it? |
Purpose
Add configuration option to disable automatic jsonapi pagination links.
As my application does not make use of these links, I'd like to avoid the extra database query they cause (a
count
to get the total pages).Changes
Adds
ActiveModel::Serializer.config.jsonapi_pagination_links_enabled
. Default istrue
.Related GitHub issues
#1596
#1823