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 products.id=categories_products.product_id') arel=arel.where('categories_products.category_id in (:fc_list)', :fc_list => params[:fc]).uniq arel=arel.group('product_id').having('count(category_id) = :size', :size => params[:fc].size) end
So the idea is to allow the user to check a checkbox list and then display all the products that are in the checked categories.
My heroku error is: "products.id" 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 problem.
Thank you in advance.
Regards, Miguel A.