Last active
August 29, 2015 14:05
-
-
Save skatenerd/f0e3d33dc44df7132088 to your computer and use it in GitHub Desktop.
poo
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
class Album < ARModelSomething | |
class Presenter | |
def detailed(album): | |
{title: album.title, | |
other: album.stuff | |
} | |
end | |
def sumary(album): | |
{ | |
fewer: things | |
} | |
end | |
end | |
end | |
class Song < ARModelSomething | |
class Presenter | |
def detailed(song): | |
{title: song.title, | |
other: song.stuff | |
} | |
end | |
def sumary(song): | |
{ | |
fewer: things | |
} | |
end | |
end | |
end | |
class MyController < SomeOtherMagic | |
def get | |
album = Albums.get() | |
album_dict = Albums::Presenter.detailed(album) | |
album_dict['songs'] = album.songs.map do |song| | |
Songs::Presenter.summary(song) | |
end | |
return album_dict.to_json | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment