PG ::错误:错误:类型时间的输入语法无效:“2013-03-17”
问题描述:
试图将用户选择的“f.date_select”日期属性保存为:sizes,:time。PG ::错误:错误:类型时间的输入语法无效:“2013-03-17”
PG::Error: ERROR: invalid input syntax for type time: "2013-03-17" : INSERT INTO "sizes"
表格尺寸/形式。
<%= form_for [@user, @size] do |f| %>
...
<%= f.date_select :time, :start_year => 2007, :end_year => 2014 %>
...
<% end %>
迁移:
def change
add_column :sizes, :time, :date
end
谢谢!
你用'date'或'datetime'列试过吗? '时间'[仅限数小时](http://www.postgresql.org/docs/8.2/static/datatype-datetime.html)。 – 2013-03-17 15:40:36
:时间是列名称,并且:日期是列类型 – 2013-03-17 16:00:47
问题是通过将时间列重新命名为大小表来解决的。 我相信它困惑的东西。 – 2013-03-17 17:07:49