Search code examples
ruby-on-railsdateactionview

ActionView DateHelper won't format certain numbers


I'm moving a system to a new server. The code is the same on both servers. What is different (and wrong) is the output from methods within DateHelper.

Both fine:

?> time_ago_in_words(Time.now)
=> "less than a minute"

?> time_ago_in_words(Time.now - 1.month)
=> "about 1 month"

Broken:

?> time_ago_in_words(Time.now - 15.days)
=> "¨¨count¼¼ days"

In the HTML this comes out as:

{{count}} days

What's up? There's no error messages and nothing in the log. Presumably I'm missing a gem, since it works on one server but not the other. But (if so) which gem?


Solution

  • Are your gem versions same on both systems? Interpolation variable format has changed from "{{count}}" to "%{count}" at some point. Especially check the i18n gem version.

    Docs: http://guides.rubyonrails.org/i18n.html#interpolation