【发布时间】:2011-04-22 22:01:26
【问题描述】:
我有this data,我需要像这种类型的输出。我基本上需要所有的场地和日期以及与之相关的所有歌曲....如果有人能想到更好的结构以及如何实现它,我将非常感谢...
{
["Vector Arena - Auckland Central, New Zealand" =>
{
"2010-10-10" => ["Enter Sandman", "Unforgiven", "And justice for all"]
}],
["Brisbane Entertainment Centre - Brisbane Qld, Austr..." =>
{
"2010-10-11" => ["Enter Sandman"]
}]
}
到目前为止,我尝试过这个......但不确定我是否朝着正确的方向前进......
@venues = Hash.new {|hash, key| hash[key] = 0}
@requests = Request.find_all_by_artist("Metallica")
@requests.each do |request|
@venues[request.venue] = request.showdate
end
【问题讨论】:
标签: ruby-on-rails ruby arrays hash multidimensional-array