Skip to content

Commit 8314445

Browse files
authored
Merge pull request #1102 from cerebris/pr/1064
Fix inherited pagination
2 parents 854ec70 + 72912e0 commit 8314445

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

lib/jsonapi/resource.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ def inherited(subclass)
403403
subclass.abstract(false)
404404
subclass.immutable(false)
405405
subclass.caching(_caching)
406+
subclass.paginator(_paginator)
406407
subclass._attributes = (_attributes || {}).dup
407408

408409
subclass._model_hints = (_model_hints || {}).dup

test/controllers/controller_test.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3443,6 +3443,10 @@ def test_books_offset_pagination_meta
34433443
JSONAPI.configuration = original_config
34443444
end
34453445

3446+
def test_inherited_pagination
3447+
assert_equal :paged, Api::V4::BiggerBookResource._paginator
3448+
end
3449+
34463450
def test_books_operation_links
34473451
original_config = JSONAPI.configuration.dup
34483452
Api::V4::BookResource.paginator :offset

test/fixtures/active_record.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,6 +1708,9 @@ class BookResource < Api::V2::BookResource
17081708
paginator :paged
17091709
end
17101710

1711+
class BiggerBookResource < Api::V4::BookResource
1712+
end
1713+
17111714
class BookCommentResource < Api::V2::BookCommentResource
17121715
paginator :paged
17131716
end

0 commit comments

Comments
 (0)