After a long time, when I was looking for a failure in my app, it finally looks I found the problem – is that the MySQL query shown below. I know Heroku use PostgreSQL database, but most of the time there are working all my apps based on MySQL DB, but now I got an error about this query:
Tshirt.joins(:favorites => [:customers]).where(["tshirts.user_id != ?", current_user.id]).order('rand()').limit(3).uniq
Could anyone give me any help, how to fix this problem?
Thanks in advance
In Postgres, the rand function is
RANDOM()so you should chnage your order clause