-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refactor jbuilder implementation of to view to fix JSON keys that are being returned. * Sideload user tags in user controller * Deleted unnecessary partials. * Fix failing tests
- Loading branch information
Osmond Oscar
committed
Mar 14, 2016
1 parent
b4f1fdf
commit 784ed23
Showing
24 changed files
with
84 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
json.answers(answers) do |answer| | ||
json.partial! 'comments/default', data: answer | ||
json.extract! answer, :question_id | ||
json.extract! answer, :comments_count | ||
json.user do | ||
json.partial! 'users/user', user: answer.user | ||
end | ||
json.partial! 'comments/comment', comments: answer.comments | ||
json.extract! answer, :question_id, :comments_count, :id, :content, :votes_count, :created_at, :updated_at | ||
json.user { json.partial! 'users/user', user: answer.user } | ||
json.comments(answer.comments) do |comment| | ||
json.partial! 'comments/comment', comment: comment | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
json.partial! 'answer', answers: @answers | ||
json.array!(@answers) do |answer| | ||
json.partial! 'answer', answer: answer | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
json.partial! 'comments/default', data: @answer | ||
json.extract! @answer, :question_id | ||
json.extract! @answer, :comments_count | ||
json.partial! 'users/user', user: @answer.user | ||
json.partial! 'comments/comment', comments: @answer.comments | ||
json.partial! 'answer', answer: @answer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
json.comments comments, partial: 'comments/default', as: :data | ||
json.extract! comment, :id, :content, :votes_count, :created_at, :updated_at, :comment_on_id, :comment_on_type | ||
json.user { json.partial! 'users/user', user: comment.user } |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
json.array!(@resource_comments) do |comment| | ||
json.partial! 'comments/default', data: comment | ||
json.extract! comment, :comment_on_id, :comment_on_type | ||
json.partial! 'comment', comment: comment | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
json.partial! 'comments/default', data: @comment | ||
json.extract! @comment, :comment_on_id, :comment_on_type | ||
json.partial! 'comments/comment', comment: @comment |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
json.extract! question, :id, :title, :content, :votes_count ,:answers_count, :comments_count, :views, :created_at, :updated_at | ||
json.user do | ||
json.partial! 'users/user', user: question.user | ||
end | ||
json.user { json.partial! 'users/user', user: question.user } | ||
json.url question_url(question) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
json.partial! 'questions/all_questions' | ||
json.array!(@questions) do |question| | ||
json.partial! 'questions/question', question: question | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
json.partial! 'questions/question', question: @question | ||
json.partial! 'tags/tag', tags: @question.tags_to_a | ||
json.partial! 'answers/answer', answers: @question.answers | ||
# require 'pry' ; binding.pry | ||
json.partial! 'comments/comment', comments: @question.comments | ||
json.partial! 'tags/tag', tags: @question.tags | ||
json.answers(@question.answers) do |answer| | ||
json.partial! 'answers/answer', answer: answer | ||
end | ||
json.comments(@question.comments) do |comment| | ||
json.partial! 'comments/comment', comment: comment | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
json.tags tags | ||
json.tags tags.map(&:name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
json.array!(@tags) do |tag| | ||
json.extract! tag, :id | ||
json.url tag_url(tag, format: :json) | ||
end | ||
json.partial! 'tag', tags: @tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
json.extract! @tag, :id, :created_at, :updated_at | ||
json.partial! 'tag', tag: @tag |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
json.extract! user, :id, :name, :email, :points, :image | ||
json.extract! user, :id, :name, :points | ||
json.image user.image | ||
json.url user_url(user, format: :json) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
json.array!(@users) do |user| | ||
json.partial! "user", user: user | ||
json.subscriptions user.tags.pluck(:name) | ||
json.url user_url(user, format: :json) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
json.partial! "user", user: @user | ||
json.extract! @user, :active, :created_at, :updated_at | ||
json.subscriptions @user.tags.pluck(:name) | ||
json.partial! 'tags/tag', tags: @user.tags | ||
json.extract! @user, :email, :active, :created_at, :updated_at |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters