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

Convert to_json to as_json to follow Ruby/Rails convention #9

Merged
merged 1 commit into from
Nov 2, 2023

Conversation

chadwilken
Copy link
Collaborator

Presently we are using to_json to render the JsonRenderable class to a Hash representation of the object (useful for storing in the DB for example). That doesn't follow the convention though where to_json should return the JSON string representation of the object. Instead we should be using as_json or to_h. I opted to implement as_json and alias to_h to that method.

@chadwilken chadwilken merged commit f122f0d into master Nov 2, 2023
1 check passed
@chadwilken chadwilken deleted the rename-to_json branch November 2, 2023 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant