@@ -77,13 +77,13 @@ If you are using `JSON` adapter, pagination links will not be included automatic
7777Add 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 }
8888end
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)
133133end
134134```
0 commit comments