[Rails] Re: do not understand collect method use wit property

2009-03-11 Thread Hiro Protagonist
Cool. Thanks for explanation. Pete Harold wrote: > They are both equivalent in terms of functionality. > > The first is a common rails idiom: > > @some_collection.collect(&:id) > or > @some_collection.map(&:id) #I've seen this one used more than > collect... > > The ampersand syntax is simpl

[Rails] Re: do not understand collect method use wit property

2009-03-11 Thread Harold
They are both equivalent in terms of functionality. The first is a common rails idiom: @some_collection.collect(&:id) or @some_collection.map(&:id) #I've seen this one used more than collect... The ampersand syntax is simply telling the interpreter that the symbol is the block parameter to the