Skip to content

Commit 3c6eb57

Browse files
committed
Replace object with collection.
Replace resource with collection.
1 parent d6b1b1c commit 3c6eb57

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

docs/howto/add_pagination_links.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ If you are using `JSON` adapter, pagination links will not be included automatic
7777
Add this method to your base API controller.
7878

7979
```ruby
80-
def pagination_dict(object)
80+
def pagination_dict(collection)
8181
{
82-
current_page: object.current_page,
83-
next_page: object.next_page,
84-
prev_page: object.prev_page, # use object.previous_page when using will_paginate
85-
total_pages: object.total_pages,
86-
total_count: object.total_count
82+
current_page: collection.current_page,
83+
next_page: collection.next_page,
84+
prev_page: collection.prev_page, # use collection.previous_page when using will_paginate
85+
total_pages: collection.total_pages,
86+
total_count: collection.total_count
8787
}
8888
end
8989
```
@@ -122,13 +122,13 @@ render json: @posts, each_serializer: PostPreviewSerializer, meta: meta_attribut
122122

123123
```ruby
124124
#expects pagination!
125-
def meta_attributes(resource, extra_meta = {})
125+
def meta_attributes(collection, extra_meta = {})
126126
{
127-
current_page: resource.current_page,
128-
next_page: resource.next_page,
129-
prev_page: resource.prev_page, # use resource.previous_page when using will_paginate
130-
total_pages: resource.total_pages,
131-
total_count: resource.total_count
127+
current_page: collection.current_page,
128+
next_page: collection.next_page,
129+
prev_page: collection.prev_page, # use collection.previous_page when using will_paginate
130+
total_pages: collection.total_pages,
131+
total_count: collection.total_count
132132
}.merge(extra_meta)
133133
end
134134
```

0 commit comments

Comments
 (0)