spree-contrib / spree_globalize

Adds support for model translations (multi-language stores) using Globalize gem
https://spreecommerce.org
BSD 3-Clause "New" or "Revised" License
24 stars 102 forks source link

Preload using with_translations #92

Closed npflood closed 2 years ago

npflood commented 2 years ago

Fixes #90

Navigating to a taxon view in spree_frontend (any URL like /t/taxon_name) where products should be returned raised PG::GroupingError: ERROR: column "spree_product_translations.id" must appear in the GROUP BY clause or be used in an aggregate function

Removing the .includes(:translations).references(:translations) from the spree_base_scopes method in SpreeGlobalize::Translatable allows the query to succeed, but causes n+1 queries.

Adding .with_translations to the spree_base_scopes method in SpreeGlobalize::Translatable allows the query to succeed, without n+1 queries.

npflood commented 2 years ago

This fixes an issue with a currently released version of Spree. Can someone review the changes and either merge this branch or indicate that the underlying issue has been resolved in another way?

ajahongir commented 2 years ago

is this going to be accept?

mrbrdo commented 2 years ago

I can also confirm this bug and the fix works, should be merged...