-
Notifications
You must be signed in to change notification settings - Fork 24
Allow direct access to Bioschemas JSON-LD #1167
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -35,6 +35,7 @@ def show | |||||
| format.html | ||||||
| format.json | ||||||
| format.json_api { render json: @material } | ||||||
| format.jsonld { render plain: @bioschemas.first.to_json } | ||||||
|
||||||
| format.jsonld { render plain: @bioschemas.first.to_json } | |
| format.jsonld { render json: @bioschemas.first.generate } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider using
render json: @bioschemas.first.generateinstead ofrender plain: @bioschemas.first.to_json. This would allow Rails to handle JSON serialization consistently and automatically set proper headers. Thegeneratemethod returns a hash which Rails can serialize, avoiding the need for manualto_jsonconversion andplainrendering.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used
to_jsonbecause it pretty generates it with nice formatting.