Forum: Rails deployment Is "ampersand-colon" a preferable way to pass a proc to a method in Rails source?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
76637432e9fb27facc3764c2f5c35585?d=identicon&s=25 Alexey M. (alexey_m)
on 2011-12-11 15:29
Hello, i am trying to fix a bug in Rails, and also improve readability
of the code i am coming across in this process.  I have a question: is

  map(&:to_s)

preferred over

  map { |n| n.to_s }

?

I was going to use the first form, but decided to ask first.

Alexey.
76637432e9fb27facc3764c2f5c35585?d=identicon&s=25 Alexey M. (alexey_m)
on 2011-12-11 15:39
Sorry, this was probably a wrong forum to post this.
This topic is locked and can not be replied to.