Pregunta

i just installed the braintree payment gem and now i'm receiving a error on a page that was working previously. i have a model named Address.

superclass mismatch for class Address

is this expected because braintree has a class named Address as well? how would i work around it/fix it?

i'm using the latest braintree gem (v2.25), ruby 2.0 on rails 4.0

¿Fue útil?

Solución 2

Turned out I had 2 versions of Braintree installed (2.16 and 2.25). After uninstalling the older one, I no longer receive the error.

Otros consejos

You're correct. The Braintree gem has a class Address. However, the Address class is inside of the Braintree module. Since it is inside of a module, your class should not conflict with it. Unless of course, your Address class is also inside of a module named Braintree. You should see this sort of behavior in irb:

module Braintree
    class Address
    end
end

module MyModule
    class Address < String #Or ActiveRecord::Base or any class
    end
end

Should work just fine, since your address is in a different module. However, if they are in the same module:

module Braintree
    class Address
    end
end

module Braintree
    class Address < String #Or ActiveRecord::Base or any class
    end
end

You will see an error similar to what you posted above.

So your options are to make sure that your Address class is named uniquely, or ensure that it is inside of a different module and you are referring to the correct Address object whenever you refer to one.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top