scope :unapproved, lambda {|event| where("event_id = ? AND status IS NOT ?",
event.id, "approved")}
The :unapproved scope works with SQLite and MySQL, but it doesn’t work on Heroku where it uses PostgreSQL. I can’t figure out how to make it work with PostgreSQL.
PostgreSQL doesn’t use
ISorIS NOTfor general comparisons, you want<>or!=:<>should work in MySQL and SQLite as well except when you want to compare against a NULL, then you have to useIS NULLorIS NOT NULLeverywhere.ISis used for special comparisons such asIS NULLandIS DISTINCT FROM, see the Comparison Operators section of the PostgreSQL manual for further details.If you’re planning on deploying on Heroku, you really should be developing on top of PostgreSQL (8.3 for a shared database, 9.0 for a dedicated one). PostgreSQL is a fair bit stricter than SQLite (and MySQL) and no ORM can fully insulate you from the differences between databases. The behavior of GROUP BY is another common problem when moving from SQLite/MySQL to PostgreSQL so you might want to review all you grouping; also, check how you deal with strings that are too long for your
varcharcolumns, AFAIK SQLite ignores your size limits but PostgreSQL will complain loudly if you try to exceed the column size (and MySQL will truncate your data with a mere warning unless you’ve put your server in strict mode).