time_ago_in_words => “in {{count}} days.”?

前端 未结 4 999
青春惊慌失措
青春惊慌失措 2021-02-20 12:13

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 p

4条回答
  •  遥遥无期
    2021-02-20 12:52

    It sounds to me like you don't have the same version of Ruby in Production as you do in Development. Personally I still have Ruby 1.8.7 in my Development and in the Console, I constantly get the following message when I use time_ago_in_words:

    The {{key}} interpolation syntax in I18n messages is deprecated. Please use %{key} instead.

    Now this message about deprecated does not come from Rails, it comes from Ruby. And since time_ago_in_words is a Rails helper, it seems like this feature in Rails is not compatible with the later versions of Ruby where this has been removed.

    So unless you manually want to monkey patch the actual helper in some way (I wouldn't recommend it) you can either upgrade Rails or downgrade Ruby so that they are compatible.

提交回复
热议问题