1

在我的 Rails 应用程序视图中,我有一行:

<%= number_to_human_size(4871156, :precision => 3) %>

which gives no implicit conversion of nil into Stringerror when other translations are selected other than english. 但是,线

<%= number_to_human_size(487, :precision => 3) %>

487 Bytes

使用 Rails 3.2.13 和 Ruby 2.0.0。可能是什么问题?

谢谢 :)-

4

2 回答 2

0

这是由于英语以外的语言环境的翻译不正确/未指定。

请参考 http://rorguide.blogspot.in/2011/03/i18nmissingtranslationdata-translation.html

那解决了它

我已经根据上面的链接添加了翻译,并正确地使用了语言环境文件中的语言环境变量。这使它正确。谢谢 :)-

于 2013-09-04T06:57:10.763 回答
-1

Fixed the above error by adding the following line to application.rb:

ActionController::Base.config.relative_url_root = ''

The error is most likely due to a bug in Rails version which is 3.2.13.

于 2013-09-03T11:24:11.003 回答