Skip to content

Instantly share code, notes, and snippets.

@skatenerd
Last active August 29, 2015 14:05
Show Gist options
  • Save skatenerd/f0e3d33dc44df7132088 to your computer and use it in GitHub Desktop.
Save skatenerd/f0e3d33dc44df7132088 to your computer and use it in GitHub Desktop.
poo
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