File size: 343 Bytes
f5071ca
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
json.extract! post, :id, :author_id, :recipient_id, :body
json.created_at(post.created_at.strftime('%B %e, %Y'))

# if post.images.attached?
#   json.set! 'imageUrls' do
#     urls = post.images.map do |image|
#       url_for(image)
#     end
    
#     json.array! urls
#   end
# end

json.imageUrl url_for(post.image) if post.image.attached?