Kurtis
08/10/2022, 9:14 AMRyan Woods
08/10/2022, 9:26 AMSpree::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).Kurtis
08/10/2022, 9:26 AMKurtis
08/10/2022, 9:26 AMKurtis
08/10/2022, 9:28 AMSpree::PaymentMethod.all.pluck(:name) returns [*"*Stripe*"*, *"*Klarna*"*, *"*PayPal*"*] but I can’t do anything to destroy the Klarna PaymentMethod without the above errorKurtis
08/10/2022, 9:28 AMRyan Woods
08/10/2022, 9:30 AMSpree::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. intactKurtis
08/10/2022, 9:31 AMKurtis
08/10/2022, 9:31 AMKurtis
08/10/2022, 9:31 AMKurtis
08/10/2022, 9:31 AMRyan Woods
08/10/2022, 9:40 AMKurtis
08/10/2022, 9:41 AMKurtis
08/10/2022, 9:41 AMRyan Woods
08/10/2022, 9:41 AMRyan Woods
08/10/2022, 9:41 AMKurtis
08/10/2022, 9:41 AMKurtis
08/10/2022, 9:42 AMRyan Woods
08/10/2022, 9:45 AMSpree::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 alreadyKurtis
08/10/2022, 9:46 AMKurtis
08/10/2022, 9:46 AMKurtis
08/10/2022, 9:47 AMKurtis
08/10/2022, 9:47 AMKurtis
08/10/2022, 9:47 AMKurtis
08/10/2022, 9:47 AMRyan Woods
08/10/2022, 9:47 AMKurtis
08/10/2022, 9:47 AMRyan Woods
08/10/2022, 9:49 AMfind 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 callbacksKurtis
08/10/2022, 9:49 AMKurtis
08/10/2022, 9:49 AM