我想从rails 4中的数组替换双引号

时间:2014-05-24 08:38:18

标签: ruby-on-rails arrays

我对rails数组有一个简单的问题。

代码如下:

 app/models/employee.rb
 s={}
 EmployeeDepartment.all.each{|employee_department|
  s[employee_department.name] = where(:employee_department_id => employee_department.id).count(:employee_department_id)
  #Employee.total_on(employee_department.id)
}
return s.to_a

示例输出:

[["First dept", 10], ["Second dept", 12]]

但我需要这样的输出,如下:

[['First dept', 10], ['Second dept', 12]] or [[First dept, 10], [Second dept, 12]]

有可能吗?

0 个答案:

没有答案