我有以下陣列如何將數組數組合併成一個數組?
[["convertible", "2010", "red"], ["convertible", "2010", "green"]]
怎樣上述陣列合併到這一點,無論是在導軌上或在紅寶石?
["convertible", "2010", "red", "convertible", "2010", "green"]
編輯-1
@category.each do |content|
form_chain = JSON.parse(content.content)
chained_array << form_chain.values
end
chained_array
這使輸出
[["convertible", "2010", "red"], ["convertible", "2010", "green"]]
如果我使用chained_array.flatten!
它給出了相同的結果。
有疑問時,請選擇[文件](http://ruby-doc.org/core- 2.0.0/Array.html#方法-I-弄平)。 – squiguy