Skip to content

Instantly share code, notes, and snippets.

@richmolj
Last active December 18, 2015 21:49
Show Gist options
  • Save richmolj/5850271 to your computer and use it in GitHub Desktop.
Save richmolj/5850271 to your computer and use it in GitHub Desktop.
# BgovService is just a placeholder here, to illustrate this is a service-backed
# class, not ActiveRecord
class Comment < BgovService
end
class Photo < BgovService
end
class Article
attr_accessor :name
def initialize(comment_repository, photo_repository)
@comment_repository, @post_repository = comment_repository, post_repository
end
def assemble
{
:name => @name,
:comments => @comment_repository.all,
:photos => @photo_repository.all
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment