change json contract
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
json.extract! post, :id, :content, :created_at, :updated_at
|
||||
json.extract! post, :id, :content, :created_at
|
||||
|
||||
json.quoted_post(post.quoted_post, partial: 'posts/post', as: :post) if post.quoted_post
|
||||
json.user(post.user, partial: 'users/user', as: :user) if post.user
|
||||
json.quoted_post(post.quoted_post, partial: 'posts/quoted_post', as: :post) if post.quoted_post
|
||||
json.user(post.user, partial: 'posts/user', as: :user)
|
||||
|
||||
json.url post_url(post, format: :json)
|
||||
2
app/views/posts/_quoted_post.json.jbuilder
Normal file
2
app/views/posts/_quoted_post.json.jbuilder
Normal file
@@ -0,0 +1,2 @@
|
||||
json.extract! post, :id, :content, :created_at
|
||||
json.user(post.user, partial: 'posts/user', as: :user)
|
||||
3
app/views/posts/_user.json.jbuilder
Normal file
3
app/views/posts/_user.json.jbuilder
Normal file
@@ -0,0 +1,3 @@
|
||||
json.extract! user, :id, :username
|
||||
|
||||
json.url user_url(user, format: :json)
|
||||
@@ -1,2 +1,7 @@
|
||||
json.extract! user, :id, :username, :created_at, :updated_at
|
||||
json.extract! user, :id, :username
|
||||
json.joined_at user.created_at.strftime("%B %d, %Y")
|
||||
json.following_count user.following.count
|
||||
json.follower_count user.followers.count
|
||||
json.posts_count user.posts.count
|
||||
|
||||
json.url user_url(user, format: :json)
|
||||
|
||||
Reference in New Issue
Block a user