tlconnor/activerecord-postgres-array

Constructs not proper sql on insert

strikeroff opened this issue · 1 comments

Fails on type cast. Whin trying to save model Orders it fails:

Order.create :list => [1,2,3,4]

Constructed sql:

INSERT INTO "orders" ("list",  "created_at", "updated_at") VALUES (--- 
- 18
- 18
- 21
- 44
,  '2011-09-29 14:11:31.480726', '2011-09-29 14:11:31.480726') RETURNING "id"

Migration is as follows

    t.decimal_array :list

Error was

PGError: ERROR:  column "list" is of type numeric[] but expression is of type integer
LINE 2: - 18

Fixed by pull request #5