-
Notifications
You must be signed in to change notification settings - Fork 760
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
ActiveRecord's pluck & Globalize issue ? #656
Comments
Hi, just sorted out with translation problems (distantly related with you problem) and decided to check you bug report. Here is result: irb(main):065:0> Spree::ProductProperty.where(id: 8).first.value
Spree::ProductProperty Load (0.5ms) SELECT "spree_product_properties".* FROM "spree_product_properties" WHERE "spree_product_properties"."id" = $1 ORDER BY spree_product_properties.position LIMIT 1 [["id", 8]]
Spree::ProductProperty::Translation Load (8.2ms) SELECT "spree_product_property_translations".* FROM "spree_product_property_translations" WHERE "spree_product_property_translations"."spree_product_property_id" = $1 [["spree_product_property_id", 8]]
=> "Blue"
irb(main):066:0> Spree::ProductProperty.where(id: 8).pluck(:value)
(7.9ms) SELECT "spree_product_properties"."value" FROM "spree_product_properties" WHERE "spree_product_properties"."id" = $1 ORDER BY spree_product_properties.position [["id", 8]]
=> [nil]
irb(main):067:0> Spree::ProductProperty.joins(:translations).where(id: 8).pluck('spree_product_property_translations.value')
(23.8ms) SELECT spree_product_property_translations.value FROM "spree_product_properties" INNER JOIN "spree_product_property_translations" ON "spree_product_property_translations"."spree_product_property_id" = "spree_product_properties"."id" WHERE "spree_product_properties"."id" = $1 ORDER BY spree_product_properties.position [["id", 8]]
=> ["Синий", "Blue"]
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can anybody explain why equivalent requests produce different results ?
pluck
See, related translation table is not joined automatically so we get untranslated (empty) result.
pluck
but now with translation inlcudedWhat ?! Why the translation string is
"--- Pepsi-Cola\n...\n"
and not just"Pepsi-Cola"
like in the 1st paragraph ?The text was updated successfully, but these errors were encountered: