I am trying to translate my Rails 3 application, read the primer at http://guides.rubyonrails.org/i18n.html#adding-date-time-formats and subsequently downloaded the corresponding yml file from https://github.com/svenfuchs/rails-i18n/tree/master/rails/locale (de.yml
in my case).
In one of my views I had this code (some_model#index
) ...
<td><%= time_ago_in_words(some_model.created_at) %></td>
... which I changed in ...
<td><%=l time_ago_in_words(some_model.created_at) %></td>
.
Unfortunately this gives me this error:
Object must be a Date, DateTime or Time object. "etwa ein Monat" given.
Any idea why this fails? The created_at
column has been created in the database via standard Rails scaffolding (database is mysql using mysql2 gem).
If I strip the time_ago_in_words
helper from the code ...
<td><%=l some_model.created_at %></td>
.
... the translation works - but the datetime now is of course too long for my <td>
.
I also tried to duplicated the distance_in_words
section of the de.yml
and rename it to time_ago_in_words
but this did not work either.
Am I missing something obvious?
<td><%= time_ago_in_words(some_model.created_at) %></td>
again and hoping for an answer here. Without the<%=l
the translation suddenly works. o_O – tschlein