Question

i recently installed Braintree payment gem. It conflicted with my Address model since Braintree has their own Address model too, so i moved my Address model inside my own module.

module MyModule
   class Address < ActiveRecord::Base
   end
end

However every time I use Address, i have to prefix MyModule::Address otherwise it uses Braintree::Address by default if i don't use the MyModule prefix.

how i do tell rails to use MyModule::Address by default?

Was it helpful?

Solution

Just alias Address to your own class.

 Address = MyModule::Address

If you're inside the Braintree module, you can access your class using the :: syntax like so:

::Address
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top