Skip to content

Instantly share code, notes, and snippets.

@Whiteknight
Created December 12, 2012 23:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Whiteknight/4272516 to your computer and use it in GitHub Desktop.
Save Whiteknight/4272516 to your computer and use it in GitHub Desktop.
If I run this code as-is, the function returns the list of posts as expected. If I uncomment line #4, the function returns an array of nil, breaking my view.
def posts_in_order
ordered = posts.sort{|x, y| x.number <=> y.number }
dummy = for i in (0..ordered.length) do
#x = ordered[i].number
end
return ordered
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment