globalize/globalize

Translations are always queried eventhough unused

Opened this issue · 0 comments

Hi, I tried these queries on my app:

Model.where(id:123)
Model Load (3.0ms)  SELECT  "model"."id", "model"."column1", "model"."created_at", "model"."updated_at" FROM "model" WHERE "model"."id" = $1 LIMIT $2  [["id", 123], ["LIMIT", 11]]
Model::Translation Load (0.5ms)  SELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = $1  [["model_id", 123]]

why are translations auto loaded? How do I disable this? I also tried:

Model.where(id:123).select(:id)
Model Load (0.7ms)  SELECT  "model"."id" FROM "model" WHERE "model"."id" = $1 LIMIT $2  [["id", 123], ["LIMIT", 11]]
Model::Translation Load (0.4ms)  SELECT "model_translations".* FROM "model_translations" WHERE "model_translations"."model_id" = $1  [["model_id", 123]]

Eventhough I selected id, it still autoloads the translation and when I queried the translated columns, it didnt raise a missing attribute error.
Seems like its the same issue as this #730
Please help as its causing slowness in my app. Thanks

gem versions:
rails 5.2.8.1
globalize 6.2.1
globalize-accessors 0.3.0