MySQL and Postgres

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

MySQL and Postgres

Alex jimmy Montaño fuentes
Hello all,

I'm a RoR begginer and am developing my app using MySQL but Heroku uses
Postgres, so my arel isn't working quite properly.

I've searched about the outputted error but in my case, since I'm doing
a query between a HABTM table, things aren't going so well.

Basically, a Product has_and_belongs_to_many Categories. My relation is
all set and everything works locally, but on deploy a 500 error occurs.

So without further delay, the issue is:

(...previous queries that work good locally and on heroku...)
if params[:fc].present? (checks if checkboxes have been ticked)
          arel=arel.joins('INNER JOIN categories_products ON')
          arel=arel.where('categories_products.category_id in
(:fc_list)', :fc_list => params[:fc]).uniq
'product_id').having('count(category_id) =
:size', :size => params[:fc].size)

So the idea is to allow the user to check a checkbox list and then
all the products that are in the checked categories.

My heroku error is: "" must appear in the GROUP BY clause or
be used in an aggregate function.

I know that there are already threads on this but none have fixed my

Thank you in advance.

Miguel A.

Posted via

You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at