Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix json render #24

Merged
merged 2 commits into from
Sep 22, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/controllers/health_monitor/health_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ def check
respond_to do |format|
format.html
format.json do
render json: statuses
render json: statuses.to_json
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

render json: statuses should have worked out of the box, so I'm not sure why it didn't work for you. Are you using any special or outdated serialization gems/overrides?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, you're right. Did a quick dig and found the culprit to be the gem active_model_serializers. That being said, it doesn't hurt by adding that explicit conversion in, no?

Copy link
Owner

@lbeder lbeder Sep 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might look weird why is it explicitly converted this way, while not in other places. Can you add statuses.to_xml below, for symmetry?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

end
format.xml do
render xml: statuses
render xml: statuses.to_xml
end
end
end
Expand Down