Closed ewamarciniak closed 10 years ago
I'll have a look at this today. I'll also see about adding a mapping from Ruby's Date
class to a Postgres DATE
column. It's something I meant to do a while ago, but nearly everything I was doing used Time
instead of Date
, so I never needed it.
Also, just to be clear, this issue should actually go on the perpetuity-postgres repo. ;-) All of the query generation and serialization things are specific to the database adapter.
I've just fixed this in perpetuity-postgres
(range-query commit and date-serialization commit) and released version 0.0.7.
Excellent, works like a charm :) Thanks
I cannot implement the date range query: start_date = '2014-03-30' end_date = '2014-08-05' documents =Perpetuity[Document].select { |document| document.revision_date.in (start_date.to_time..end_date.to_time) } puts documents.to_a.size
This generates 2014-08-23 14:36:54 BST ERROR: syntax error at or near "2014" at character 49 2014-08-23 14:36:54 BST STATEMENT: SELECT * FROM "Document" WHERE revision_date IN 2014-03-30 00:00:00 UTC..2014-08-05 00:00:00 UTC instead of 2014-08-23 14:36:54 BST ERROR: syntax error at or near "2014" at character 49 2014-08-23 14:36:54 BST STATEMENT: SELECT * FROM "Document" WHERE revision_date IN '2014-03-30 00:00:00 UTC'..'2014-08-05 00:00:00 UTC'