Created
July 13, 2010 22:23
-
-
Save garybernhardt/474648 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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