Commit 38204f8a
Changed files (2)
app
views
api
v2
cakes
spec
controllers
api
app/views/api/v2/cakes/index.json.jbuilder
@@ -7,10 +7,11 @@ end
json.photos @cakes.map { |x| x.photos }.flatten do |photo|
json.partial! photo, photo: photo
end
-json.categories Category.all do |category|
+json.categories @categories do |category|
json.partial! category, category: category
end
json.meta do
+ json.page @cakes.current_page
+ json.perPage @cakes.limit_value
json.totalPages @cakes.total_pages
- json.total_pages @cakes.total_pages
end
spec/controllers/api/v2/cakes_controller_spec.rb
@@ -3,6 +3,8 @@ require 'rails_helper'
module Api
module V2
describe CakesController do
+ render_views
+
describe "#index" do
let!(:cake) { create(:published_cake) }