When using devise :doorkeeper in a model, the Rails module will be hidden by Doorkeeper::Rails and only accessible as ::Rails
I created a minimal project to highlight the issue; it is a minimal rails app with added devise-doorkeeper and minimal configurations for devise, doorkeeper and devise-doorkeeper. The only created test will highlight the error alternatively simply open a console and invoke User.new.rails_version:
Loading development environment (Rails 6.1.4.1)
3.0.2 :001 > User.new.rails_version
(1.7ms) SELECT sqlite_version(*)
/Users/username/Development/devise-doorkeeper-classloading-issue/app/models/user.rb:6:in `rails_version': undefined method `version' for Doorkeeper::Rails:Module (NoMethodError)
When using
devise :doorkeeperin a model, theRailsmodule will be hidden byDoorkeeper::Railsand only accessible as::RailsI created a minimal project to highlight the issue; it is a minimal rails app with added devise-doorkeeper and minimal configurations for devise, doorkeeper and devise-doorkeeper. The only created test will highlight the error alternatively simply open a console and invoke
User.new.rails_version: