I am getting an ActiveRecord PGError on Heroku not locally. The error message from the Heroku Logs is:
ActiveRecord::StatementInvalid (PGError: ERROR: column items.user_id does not exist
LINE 1: SELECT “items”.* FROM “items” WHERE (“items”.user_id = 4) OR
This code works locally (SQLite) but not on Heroku (postgresql) so I have been reading about the differences. At first I thought that it was a case issue as I recognised that it should be User_ID — but now I’m not sure, it’s something about “items” that isn’t quite right and I can’t work out exactly what it is.
As I said this works absolutely fine on my local machine, it’s only on heroku and postgres that the problem comes up.
Thanks in advance.
It was a case issue after all – postgres does (I believe) a downcase on everything before sending it to the db — my
user_idwas actually called, inexplicably,User_ID; after migration everything is working — thanks to those that helped.