开发者

Rails error when using %d (deprecated) on translating dates, what should i use instead?

开发者 https://www.devze.com 2023-01-03 07:08 出处:网络
In language file es.yml i have time: formats: short: \"%d %b %H:%M\" when i try using it like: <%= l my_object.created_at, :format => :short %>

In language file es.yml i have

time:
    formats:
      short: "%d %b %H:%M"

when i try using it like:

<%= l my_object.created_at, :format => :short %>

it shows the following error

ActionView::TemplateError (missing interpolation argument in "%{count} %b %H:%M" ({:object=>Fri, 11 Jun 2010 09:00:00 CDT -05:00} given)) on line #68 of app/views/matches/_by_session.html.erb:  
65:               `</div>`  
66:   
67:               `<div>`  
68:                       `<%= l match.starts_at, :format => :short %>`  
69:               `</div>`  
70:  
71:             `</div>`  

How should I 开发者_JAVA技巧display the day... if %d doesnt work anymore.... Any ideas???


I ran into this problem and it took me ages to work it out.

For me the problem was I also had Rails version 3 beta installed and a prerequisite for that is the I18n gem.

This is not required for version 2.* of rails and simply uninstalling this gem (I18n) resolved my issues.


Yep indeed i had the same kind of error:

I18n::MissingInterpolationArgument in Admin/campaigns#index
Showing app/views/admin/campaigns/_campaign.html.erb where line #3 raised:
missing interpolation argument in "%Y/%m/%{count}" ({:object=>Mon, 19 Jul 2010 15:15:57 CEST +02:00} given)

Uninstalling the i18n gem fixed it

0

精彩评论

暂无评论...
验证码 换一张
取 消