我有一个迁移:日期字段和轨道的TextInput
def change
create_table :tasks do |t|
t.date :date, :null => false
end
end
和一个视图:
<%= form_for @task do |f| %>
<%= f.text_field :date %>
<% end %>
的问题是
为什么我有“2011-12 -23 00:00:00“而不是”2011年12月23日“已经在数据库中的记录?在数据库中,它们处于“2011-12-23”格式。
如何内部日期,所以我可以有像“12.23.11”日期。
您正在使用什么数据库?我执行了[这些命令](https://gist.github.com/d5c2d25df5988b45e163),设置'root:to => tasks#index',然后创建一个新任务,并且所有事情都按预期工作(即没有结尾00:00 :00)。 – Alex 2012-01-04 10:14:01