I’m getting strange error
ActionView::Template::Error (wrong argument type nil (expected Fixnum)):
On this line:
<%= (!attach.file_size.nil?) ? "(#{number_to_human_size(attach.file_size.to_i).to_s})": "" %>
Here’s my code:
<% 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 %>
I don’t get where problem is. Help me please. Thanks!
What locale? If not an English locale, try one.
Sounds a lot like this bug, in which a call to
number_to_human_sizeeventually calledBigDecimal.new(the_number.to_s).round(...).to_f, and theround()ing failed because of a locale issue. The exception generated exactly matches your error (“wrong argument type nil (expected Fixnum)”).