[英]how do I display the in views this hash?
how do I display the in views this hash? 如何在此哈希视图中显示in?
class Credit < ActiveRecord::Base
serialize :credit_data
end
I got the hash, but I can't display it in views. 我得到了哈希,但是无法在视图中显示它。
=> [#<Credit:0x00000005d49900
id: 18,
credit_data:
{3000=>[{1=>492}, {2=>984}, {3=>1536}, {4=>2136}, {5=>2760}],
4000=>[{1=>656}, {2=>1328}, {3=>2048}, {4=>2816}, {5=>3620}],
5000=>[{1=>820}, {2=>1648}, {3=>2560}, {4=>3544}, {5=>4540}],
........
created_at: Wed, 04 Mar 2015 14:22:59 UTC +00:00,
updated_at: Wed, 04 Mar 2015 14:22:59 UTC +00:00>]
I am not sure but you can try something like this 我不确定,但是您可以尝试这样的方法
<table>
<tr>
<% credit_data.each do |k,v| %>
<th><%= k %></th>
<% v.each do |v1| %>
<td><%= v1.values %></td>
<% end %>
<% end %>
</tr>
</table>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.