我正在使用Rails 3.2.7和Postgres 9.2尝试创建日期范围
以下是我创建它的方式
schedule_block = ScheduleBlock.new
schedule_block.date_range = [Date.new, Date.new]
schedule_block.save
这是结果查询和错误:
INSERT INTO "schedule_blocks" ("date_range") VALUES ($1) RETURNING "id" [["date_range", [Mon, 01 Jan -4712, Mon, 01 Jan -4712]]]
PG::Error: ERROR: malformed range literal: "---
- -4712-01-01
- -4712-01-01
"
DETAIL: Missing left parenthesis or bracket.
: INSERT INTO "schedule_blocks" ("date_range") VALUES ($1) RETURNING "id"
(0.1ms) ROLLBACK
Completed 500 Internal Server Error in 496ms
我该如何做到这一点?