Skip to content

Instantly share code, notes, and snippets.

@marcusramberg
Created June 7, 2013 22:13
Show Gist options
  • Save marcusramberg/5732782 to your computer and use it in GitHub Desktop.
Save marcusramberg/5732782 to your computer and use it in GitHub Desktop.
json.array! @ranking.results_with_change.each_with_index.to_a do |args|
# We can't unpack the args in the block param because Jbuilder does
# something magic.
(user, player, diff), index = *args
json.rank index+1
json.user user, :id, :facebook_id, :name, :square_avatar
json.score player.r.to_i
json.change_today diff.to_i
json.r player.r
json.rd player.rd
json.vol player.vol
end
@batter
Copy link

batter commented Jun 16, 2015

Nice hack 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment