Created
July 20, 2012 23:08
-
-
Save ch1ago/3153788 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
posts = User.last.posts_feed(params.slice(:limit, :before)) | |
posts = V1::PostPresenter(posts) | |
class V1::PostPresenter < V1::BasePresenter | |
attr_accessor :model | |
def initialize(model) | |
self.model = model | |
end | |
def V1::PostPresenter(models) | |
models.map { |m| new m } | |
end | |
def as_json(options={}) | |
{at: model.created_at, user_id: model.user_id} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment