Last active
March 18, 2020 21:28
-
-
Save starwels/a098cdf0f2213fa34dc0664c08d25061 to your computer and use it in GitHub Desktop.
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
class PostPresenter | |
def index | |
posts = Post.includes(:comments).order(id: :asc).as_json(include: [:comments]) | |
posts.map { |post| post['status'] = post['created_at'] < post['updated_at'] ? '(edited)' : '(first version)' } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment