mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
Add guard clause and remove conditionals
Sometimes the objects are not paginated. In this case we need to avoid trying to render pagination data, as it will throw an error. This guard clause also means we can remove messy conditionals from several controllers.
This commit is contained in:
@@ -16,7 +16,7 @@ module Api
|
||||
|
||||
render json: {
|
||||
orders: serialized_orders(orders),
|
||||
pagination: pagination_required? ? pagination_data(orders) : nil
|
||||
pagination: pagination_data(orders)
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user