I’ve deleted Klarna gem and can’t get anywhere wit...
# support
k
I’ve deleted Klarna gem and can’t get anywhere with payment methods
1
r
I am a bit confused on your progress with Klarna. Do you want to remove it completely as well? Which Klarna gem are you referring to? (I think they are several) The problem is
Spree::Gateway::KlarnaCredit
has an attribute, and therefore db column of
type
, which is reserved to Rails. Models can only have a column of
type
if they are going to do STI (Single Table Inheritance).
k
I would like it removed completely
I deleted all references, but my prod has it existing as a PaymentMethod, and I can’t delete it
Spree::PaymentMethod.all.pluck(:name)
returns
[*"*Stripe*"*, *"*Klarna*"*, *"*PayPal*"*]
but I can’t do anything to destroy the Klarna PaymentMethod without the above error
I literally just want the entire thing ripped out
r
You maybe able to remove the gem down the line, but you probably will want to have a dummy
Spree::Gateway::KlarnaCredit
model, because
Spree::PaymentSource
records will still reference to
Spree::Gateway::KlarnaCredit
. And normally you want to keep the historical records of payments/orders, etc. intact
k
I’ve deleted all payments that used it
And all orders
I am just doing so out of desperation
It’s a live issue and I have no idea wtf I’m doing 😂
r
Are you getting the error when you attempt to delete the payment method?
k
Yes
Thanks for your help btw, super stressed
r
How are you attempting to delete it?
no problem
❤️ 1
k
Spree::PaymentMethod.find_by_name(“Klarna”).destroy
Spree::PaymentMethod.where(name: “Klarna”).destroy_all
r
Try this
Spree::PaymentMethod.where(name: 'Klarna').delete_all
, normally you want to be really careful deleting payment methods. but you told me all the payment method names already
k
It returned 0
Spree::*PaymentMethod*.where(name: *‘*Klarna*’*).delete_all
Return 1
😄
It’s working again man
🙌 1
Thank youuuuu
r
No problem!
k
Any chance you have an idea about my AWS/S3 issue?
👀 1
r
The problem was that the other methods were trying to instantiate the class, but the class doesn’t exist anymore due to dropping the gem.
find
and
find_by
return one instance, but the where returns an association, so the class doesn’t get instantiated.
delete
also doesn’t run any callbacks
k
Ahhhhh I never knew that
Thanks a lot man