Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translations are always queried eventhough unused #809

Open
madyarini opened this issue Sep 11, 2023 · 0 comments
Open

Translations are always queried eventhough unused #809

madyarini opened this issue Sep 11, 2023 · 0 comments

Comments

@madyarini
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant