我收到奇怪的错误
ActionView::Template::Error (wrong argument type nil (expected Fixnum)):
在这条线上:
<%= (!attach.file_size.nil?) ? "(#{number_to_human_size(attach.file_size.to_i).to_s})": "" %>
这是我的代码:
<% if !pr.attachments.empty? %>
<ul class="attached_files">
<% pr.attachments.each do |attach| %>
<li><a href="<%= attach.path_url%> " target="_blank"><%= attach.path_identifier%></a>
<%= (!attach.file_size.nil?) ? "(#{number_to_human_size(attach.file_size.to_i).to_s})": "" %>
</li>
<%end%>
</ul>
<% end %>
我不明白问题出在哪里。请帮帮我。谢谢!