Skip to content

Instantly share code, notes, and snippets.

@vinniefranco
Created January 25, 2011 23:22
Show Gist options
  • Save vinniefranco/795917 to your computer and use it in GitHub Desktop.
Save vinniefranco/795917 to your computer and use it in GitHub Desktop.
json.gallery do |g|
g.info do |info|
info.title @gallery.title if @gallery.title
info.image @gallery.image.l(:medium) if @gallery.image
info.parent_id @gallery.parent_id if @gallery.parent_id
info.root true unless @gallery.parent_id
end
@gallery.photos.each do |photo|
g.photos do |p|
p.id photo.id
p.title photo.title
p.description photo.description
p.image photo.image.l(:medium) if photo.image
end
end
@gallery.galleries.each do |gallery|
g.galleries do |gg|
gg.id gallery.id
gg.title gallery.title
gg.meta concat_meta(gallery)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment