@@ -77,13 +77,13 @@ If you are using `JSON` adapter, pagination links will not be included automatic
77
77
Add this method to your base API controller.
78
78
79
79
``` ruby
80
- def pagination_dict (object )
80
+ def pagination_dict (collection )
81
81
{
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
87
87
}
88
88
end
89
89
```
@@ -122,13 +122,13 @@ render json: @posts, each_serializer: PostPreviewSerializer, meta: meta_attribut
122
122
123
123
``` ruby
124
124
# expects pagination!
125
- def meta_attributes (resource , extra_meta = {})
125
+ def meta_attributes (collection , extra_meta = {})
126
126
{
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
132
132
}.merge(extra_meta)
133
133
end
134
134
```
0 commit comments