to_proc or not to proc

Instead of writing this

Profile.find(:all).collect{ |x| x.email }

I could write this using Rails’ Symbol#to_proc

Profile.find(:all).collect(&:email)

Nice.

No comments yet.

Leave a Reply