time_ago_in_words => “{count}}天”。 [英] time_ago_in_words => "in {{count}} days."?

查看:252
本文介绍了time_ago_in_words => “{count}}天”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常奇怪的错误。在我的代码中,我有<%= time_ago_in_words(game.created_at)%>



在我的分段服务器上,但不在我的生产服务器上:



示例: http://hockey-community.com/games/show/45



我得到在{{count}}天。



奇怪的是,如果返回的数字是1,它可以工作。 (例如: 1小时前或1天前)。



任何想法都将非常有帮助。 Thks

解决方案

Rails在助手中使用了一些不推荐的语法,然后在最新的Ruby版本中删除。如果您使用像Heroku这样的东西,请尝试告诉您的生产实例使用Rails 2.3.9。否则您还可以尝试降级Ruby。



请参阅更改日志:
http://weblog.rubyonrails.org/2010/9/4/ruby-on-rails-2-3-9-发布


将i18n命名插值语法从已弃用的Hello {{name}} 更改为1.9原生的Hello %{name}


这看起来会解决你的问题。 / p>

I'm having a very weird bug. In my code I have <%= time_ago_in_words(game.created_at) %>

It's works locally and on my staging server but NOT on my production server:

Example: http://hockey-community.com/games/show/45

I get "in {{count}} days."

Weirdly, if the number returned is 1, it works. (ex: 1 hour ago or 1 day ago).

Any idea would be very helpful. Thks

解决方案

Rails was using some deprecated syntax in the helper which then got dropped in the latest Ruby version. If you are using something like Heroku, try telling your production instance to use Rails 2.3.9. Otherwise you can also try downgrading Ruby.

See the changelog: http://weblog.rubyonrails.org/2010/9/4/ruby-on-rails-2-3-9-released

Changes i18n named-interpolation syntax from the deprecated Hello {{name}} to the 1.9-native Hello %{name}.

This looks like it will fix your problem.

这篇关于time_ago_in_words =&gt; “{count}}天”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆