You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looks like that in rails 4 we need to be a it more specific when using IN operator otherwise we get this type of error:
71) Spree::Product scopes access roles shows only products for given user
Failure/Error: product.count.should == 1
ActiveRecord::StatementInvalid:
PG::SyntaxError: ERROR: subquery has too many columns
LINE 1: ...e_products"."deleted_at" IS NULL AND (supplier_id IN (SELECT...
^
: SELECT COUNT(*) FROM "spree_products" WHERE "spree_products"."deleted_at" IS NULL AND (supplier_id IN (SELECT "enterprises".* FROM "enterprises" INNER JOIN "enterprise_roles" ON "enterprises"."id" = "enterprise_roles"."enterprise_id" WHERE "enterprise_roles"."user_id" = $1))
# ./spec/models/spree/product_spec.rb:326:in `block (4 levels) in <module:Spree>'
# ------------------
# --- Caused by: ---
# PG::SyntaxError:
# ERROR: subquery has too many columns
# LINE 1: ...e_products"."deleted_at" IS NULL AND (supplier_id IN (SELECT...
# ^
# ./spec/models/spree/product_spec.rb:326:in `block (4 levels) in <module:Spree>'
In this case, we can have
supplier_id IN (SELECT "enterprises".*
we need to have
supplier_id IN (SELECT "enterprises"."id"
Looks like that in rails 4 we need to be a it more specific when using IN operator otherwise we get this type of error:
In this case, we can have
supplier_id IN (SELECT "enterprises".*
we need to have
supplier_id IN (SELECT "enterprises"."id"
I couldnt find reference to this here:
https://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-3-2-to-rails-4-0
The text was updated successfully, but these errors were encountered: