9

Possible Duplicate:
Ruby/Ruby on Rails ampersand colon shortcut

Seen in Railscast #167 :

def tag_names
    @tag_names || tags.map(&:name).join(' ')
end

What is this &:name syntax, what does it do ?

I understand what a symbol is, but what other kinds of objects this & can be prepended to ?


Duplicate question : Ruby ampersand colon shortcut

Community
  • 1
  • 1
glmxndr
  • 45,516
  • 29
  • 93
  • 118

0 Answers0