Trying to load a product by sku (`product = Spree:...
# support
g
Trying to load a product by sku (
product = Spree::Product.find_by(sku: row['associated'])
) results in a message that says:
column spree_products.sku does not exist
, which is true, it doesn't. I've done this loading on other fields, but I guess I've done it on fields that exist in the actual table. I see the sku in
spree_variants
, but it doesn't seem to like
Spree:Variant
either. I can see that there's a sku search in the admin, but I can't quite sort out how it pulls the info. Any pointers?
Nevermind, it looks like I might have just been trying to do too many things at once and something else was throwing a fit.
Spree::Variant
seems to do the trick
j
the SKU for a product is held on its master variant
g
Yeah, and I thought I tried that, but I must have derped something when I did it before. Thanks! 😄