Created
June 11, 2017 01:03
-
-
Save fridgerator/0ff004b9bd65edc88f085d5f27be9ccb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
def present_json(json) | |
{% for f in ["id", "name", "other_attribute"] %} | |
json.field f, self.{{f.id}} | |
{% end %} | |
end | |
def present | |
JSON.object do |json| | |
present_json(json) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment