Commit 10899ba4d21033538b1eb520a7472959830aa0fb
Committed by
Rodrigo Souto
1 parent
80149fa0
Exists in
staging
and in
41 other branches
adding root clause in entities return
Showing
1 changed file
with
3 additions
and
0 deletions
Show diff stats
lib/api/entities.rb
| 1 | 1 | module API |
| 2 | 2 | module Entities |
| 3 | 3 | class Article < Grape::Entity |
| 4 | + root 'articles', 'article' | |
| 4 | 5 | expose :id, :name, :body, :created_at |
| 5 | 6 | |
| 6 | 7 | expose :author do |article, options| |
| ... | ... | @@ -17,6 +18,7 @@ module API |
| 17 | 18 | end |
| 18 | 19 | |
| 19 | 20 | class Comment < Grape::Entity |
| 21 | + root 'comments', 'comment' | |
| 20 | 22 | expose :body, :title, :created_at, :id |
| 21 | 23 | |
| 22 | 24 | expose :author do |comment, options| |
| ... | ... | @@ -33,6 +35,7 @@ module API |
| 33 | 35 | end |
| 34 | 36 | |
| 35 | 37 | class User < Grape::Entity |
| 38 | + root 'users', 'user' | |
| 36 | 39 | expose :login |
| 37 | 40 | end |
| 38 | 41 | ... | ... |