I am having a problem with the following array iteration. I'd like to create an array jt with the phrase "food" and "drink" as can be seen from the output from first command which is constructed from an item that has two global_tags with each tag having a phrase that is, in this case, food or drink. I'm not sure why I get the two embedded arrays as seen in the last line.
1.9.3p392 :043 > m.global_tags.map { |t| puts t.tag.phrase }
drink
food
=> [nil, nil]
1.9.3p392 :044 > jt=[]
=> []
1.9.3p392 :045 > m.global_tags.map { |t| jt << t.tag.phrase }
=> [["drink", "food"], ["drink", "food"]]
1.9.3p392 :046 >
Also, I'm trying to get shorter syntax. This seems to work but not sure if this is considered ugly in Ruby terms(?)
1.9.3p392 :050 > m.global_tags.map(&:tag).map(&:phrase)
=> ["drink", "food"]
Thx for help