rails,locale不在表单中工作

时间:2013-06-25 21:00:44

标签: ruby-on-rails date

在我的应用程序中有一个表单,一个simpleform(相关吗?),它显示了一些日期字段:

<% f.input :my_date_field :as => :string %>

我希望在我的语言环境中格式化日期,即:

31/12/2013

而我得到:

2013-06-25 13:47:00

我试图解决为我的应用程序设置修复区域设置的问题,也就是说,在我设置的应用程序控制器中:

class ApplicationController < ActionController::Base

  before_filter :set_locale

  def set_locale
    I18n.locale = :it
  end

  end


所以它应该将语言环境设置为:它无论浏览器说什么。

没有结果。这里的问题是两个。谁将日期转换为字符串,我该如何影响它呢?

0 个答案:

没有答案