File size: 617 Bytes
f5071ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

json.extract! post, :id, :author_id, :wall_id, :body, :created_at
json.photo asset_path(post.photo.url)
json.authorfname  post.author.fname
json.profile_image_url asset_path(post.author.profile_image_url)

json.wall post.wall
if post.comments
  json.comments do
    post.comments.each do |comment|
      json.set! comment.id do
        json.partial! 'api/comments/comments', comment: comment
        json.authorid comment.author.id
        json.authorpic asset_path(comment.author.profile_image_url.url)
        json.authorf comment.author.fname
        json.authorl comment.author.lname
      end
    end
  end
end