Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

ActiveRecord::SubclassNotFound after trying to save payment gateway record #147

Closed
digitalWestie opened this issue Jan 16, 2018 · 4 comments

Comments

@digitalWestie
Copy link

I'm using solidus 2.4.2, and after installing gem from latest commit:

gem 'solidus_paypal_braintree', :git => 'https://github.com/solidusio/solidus_paypal_braintree.git', :ref => '898eb2cad5438f1540bf7cb636e90a24038ad4fb'

I ran

g = SolidusPaypalBraintree::Gateway.new(
  name: "Braintree",
  preference_source: "braintree_credentials"
)
g.save

and get:

ActiveRecord::SubclassNotFound: The single-table inheritance mechanism failed to locate the subclass: 'Solidus::Gateway::BraintreeGateway'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite Spree::PaymentMethod.inheritance_column to use another column for that information.

Inspecting the object I see that g.type is "SolidusPaypalBraintree::Gateway" not Solidus::Gateway::BraintreeGateway

@digitalWestie
Copy link
Author

Ah, figured it out. Nothing to do with this gem. Before installing this gem I tried out the solidus_braintree gem and then deleted it. What I didn't realise was the payment method record still existed (as it was soft deleted) but the gateway class it was looking for no longer existed.

@gildardoperez
Copy link

@digitalWestie how did you solved deleting the gateway class? I'm getting

"ActiveRecord::SubclassNotFound (The single-table inheritance mechanism failed to locate the subclass: 'Solidus::Gateway::BraintreeGateway'. This error is raised because the column 'type' is reserved for storing the class in case of inheritance. Please rename this column if you didn't intend it to be used for storing the inheritance class or overwrite Spree::PaymentMethod.inheritance_column to use another column for that information.)"

@digitalWestie
Copy link
Author

Do you have any records in the spree_payment_methods table in your db?

I discovered I had a payment_method record that referred to a class that didn't exist anymore.

@gildardoperez
Copy link

gildardoperez commented Aug 26, 2018

@digitalWestie Hi, I found how to fix this issue. Thanks!

> rails console
irb> ActiveRecord::Base.connection.execute("DELETE FROM spree_payment_methods WHERE type='Solidus::Gateway::BraintreeGateway'")

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants