145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
# File 'lib/rest_framework/controller_mixins/models.rb', line 145
def index
@records = self.get_filtered_data(self.get_recordset)
if self.class.paginator_class
paginator = self.class.paginator_class.new(data: @records, controller: self)
page = paginator.get_page
serialized_page = self.get_serializer_class.new(object: page, controller: self).serialize
data = paginator.get_paginated_response(serialized_page)
else
data = self.get_serializer_class.new(object: @records, controller: self).serialize
end
return api_response(data)
end
|