Reputation: 195
I have moved a site from development to testing on Heroku, and thus switched from sqlite to Postgres. I am getting an error with one of the lines of code, and am not sure why it doesn't work in Postgres.
The code is:
Vendor.where.not(upload_key: "11242015213724")
This should display a list of Vendors whose upload_key is nil, however, it results in zero records.
However, if i search by:
Vendor.where(upload_key: nil)
I do get the correct result. Is there something I am missing in PostGres that doesn't allow the records with a nil upload_key to be displayed in the first statement?
Thanks!
Upvotes: 0
Views: 23
Reputation: 1923
You have to use:
Vendor.where("upload_key != ? OR upload_key is ?", "11242015213724", nil)
Upvotes: 1