Skip to content

Instantly share code, notes, and snippets.

@garybernhardt
Created July 13, 2010 22:23
Show Gist options
  • Save garybernhardt/474648 to your computer and use it in GitHub Desktop.
Save garybernhardt/474648 to your computer and use it in GitHub Desktop.
# This doesn't work – it calls nil.join (the map seems to return nil?)
puts things.to_a.sort_by(&:id).map do |thing|
"#{thing.id} #{thing.url}"
end.join("\n")
# This DOES work (the only difference is that the map uses curlies instead of do/end).
puts things.to_a.sort_by(&:id).map { |thing|
"#{thing.id} #{thing.url}"
}.join("\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment