我有一个看起来像的数组
["", "Fitness", "Stationary", "Looks", "Access", "Food",
"---\n- Stationary\n- Access\n- ''\n"] ["", "Fitness",
"Stationary", "Looks", "Access", "Food", "---\n- Stationary\n- Access\n- ''\n"]
我使用下面的代码来浏览它们......
<h3>Categories</h3>
<% for product in Product.select(:category)%>
<% a = [""].concat(Product.select(:category).map(&:category).uniq) %>
<% end %>
<% a.each do |c| %>
<p class="text-error"><%= link_to(c.delete("-"), ) %></p>
<% end %>
我得到这样的东西......
Fitness
Stationary
Looks
Access
Food
Stationary Access ''
完整代码位于:
https ://github.com/abhishekdagarit/sample-app.git
如何解决这个问题?如果数据库中有脏数据,我该如何清理?
这里有什么问题?以及如何解决?