I found this code in a RailsCast:
def tag_names @tag_names || tags.map(&:name).join(\' \') end
What does the (&:name)
(&:name)
tags.map(&:name)
is The same as
tags.map{|tag| tag.name}
&:name just uses the symbol as the method name to be called.
&:name