Created
September 29, 2015 19:52
-
-
Save sighmin/5ae7cb89e79f23e9223f 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 BaseView < SimpleDelegator | |
def self.collection(objects) | |
objects.map { |obj| new obj } | |
end | |
end | |
class UserView < BaseView | |
... | |
end | |
users = User.popular(10) | |
users = UserView.collection(users) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment