summaryrefslogtreecommitdiff
path: root/app/views/api
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2014-11-21 14:05:53 -0700
committermo khan <mo@mokhan.ca>2014-11-21 14:05:53 -0700
commit6ecba9c7d0e2dcf5a6d042a393e742c862a94750 (patch)
tree511fa1a0af5ff7a262c1b788f115212e43b45042 /app/views/api
parent5c5f82d649140d5ac6e51ed6814ef34f1e06b04e (diff)
add category lookup to api v2.
Diffstat (limited to 'app/views/api')
-rw-r--r--app/views/api/v2/cakes/_cake.json.jbuilder1
-rw-r--r--app/views/api/v2/categories/_category.json.jbuilder5
-rw-r--r--app/views/api/v2/categories/show.json.jbuilder3
3 files changed, 9 insertions, 0 deletions
diff --git a/app/views/api/v2/cakes/_cake.json.jbuilder b/app/views/api/v2/cakes/_cake.json.jbuilder
index fd8762ae..2cc585c0 100644
--- a/app/views/api/v2/cakes/_cake.json.jbuilder
+++ b/app/views/api/v2/cakes/_cake.json.jbuilder
@@ -2,6 +2,7 @@ json.id cake.id
json.name cake.name
json.description cake.story
json.author cake.user.id
+json.category cake.category.id
json.photos cake.photos.pluck(:id)
json.createdAt cake.created_at
json.updatedAt cake.updated_at
diff --git a/app/views/api/v2/categories/_category.json.jbuilder b/app/views/api/v2/categories/_category.json.jbuilder
new file mode 100644
index 00000000..7531369c
--- /dev/null
+++ b/app/views/api/v2/categories/_category.json.jbuilder
@@ -0,0 +1,5 @@
+json.id category.id
+json.name category.name
+json.slug category.slug
+json.createdAt category.created_at
+json.updatedAt category.updated_at
diff --git a/app/views/api/v2/categories/show.json.jbuilder b/app/views/api/v2/categories/show.json.jbuilder
new file mode 100644
index 00000000..5e7ac913
--- /dev/null
+++ b/app/views/api/v2/categories/show.json.jbuilder
@@ -0,0 +1,3 @@
+json.category do
+ json.partial! @category, category: @category
+end