Download facenovel/app/views/api/posts/index.json.jbuilder from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 972 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/facenovel/app/views/api/posts/index.json.jbuilder
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/facenovel/app/views/api/posts/index.json.jbuilder
-
curl -L -o index.json.jbuilder https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/facenovel/app/views/api/posts/index.json.jbuilder
972 Bytes
| user_ids = {} | |
| json.set! 'posts' do | |
| @posts.each do |post| | |
| json.set! post.id do | |
| json.partial! 'post', post: post | |
| end | |
| end | |
| end | |
| json.set! 'comments' do | |
| @posts.each do |post| | |
| if post.comments.length != 0 | |
| json.set! post.id do | |
| json.array!(post.comments) do |comment| | |
| json.partial! '/api/comments/comment', comment: comment | |
| end | |
| end | |
| end | |
| end | |
| end | |
| json.set! 'users' do | |
| @posts.each do |post| | |
| json.set! post.author_id do | |
| json.partial! '/api/users/min_user', user: post.author | |
| json.profilePictureUrl url_for(post.author.profile_picture) | |
| end | |
| json.set! post.recipient_id do | |
| json.partial! '/api/users/min_user', user: post.recipient | |
| end | |
| post.comments.each do |comment| | |
| json.set! comment.author_id do | |
| json.partial! '/api/users/min_user', user: comment.author | |
| json.profilePictureUrl url_for(comment.author.profile_picture) | |
| end | |
| end | |
| end | |
| end |