0
如何遍歷序列化哈希並只顯示視圖上的鍵?通過序列化模型上的JSON哈希進行迭代
策略模型
class Policy < ActiveRecord::Base
belongs_to :user
serialize :shipping, JSON
end
索引
<% @policy.shipping.each do |key, value|%>
<ul><li><%= key %></li></ul>
<% end %>
wee!就是這樣。謝謝你的男人! – dcalixto 2012-03-02 01:27:52