Commit 38204f8a

mo khan <mo@mokhan.ca>
2014-11-23 16:27:00
add page and perPage to meta attributes.
1 parent e0cf5c6
Changed files (2)
app
views
spec
controllers
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) }