Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rails generate doorkeeper:install fails with uninitialized constant ActiveRecord for a non-ActiveRecord project #1653

Open
zedtux opened this issue Apr 8, 2023 · 3 comments

Comments

@zedtux
Copy link

zedtux commented Apr 8, 2023

Steps to reproduce

  1. Create a non-activerecord Rails application (Mongoid, Nobrainer or whatever other ORM than ActiveRecord)
  2. Install the gem
  3. Run the rails generate doorkeeper:install command

Expected behavior

Doorkeeper should have see that ActiveRecord is unknown in my project, but I have added the doorkeeper-rethinkdb gem and should skip all the ActiveRecord code.

Actual behavior

I got the following error:

/usr/local/bundle/gems/doorkeeper-5.6.6/lib/doorkeeper/orm/active_record/access_grant.rb:6:in `<module:Doorkeeper>': uninitialized constant ActiveRecord (NameError)
Did you mean?  ActiveModel
	from /usr/local/bundle/gems/doorkeeper-5.6.6/lib/doorkeeper/orm/active_record/access_grant.rb:5:in `<main>'
	from /usr/local/bundle/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
	from /usr/local/bundle/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
	from /usr/local/bundle/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/loaded_features_index.rb:100:in `register'
	from /usr/local/bundle/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
	from /usr/local/bundle/gems/bootsnap-1.9.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
	from /usr/local/bundle/gems/zeitwerk-2.6.7/lib/zeitwerk/kernel.rb:38:in `require'
	from /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/inflector/methods.rb:288:in `const_get'
	from /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/inflector/methods.rb:288:in `block in constantize'
	from /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/inflector/methods.rb:284:in `each'
	from /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/inflector/methods.rb:284:in `inject'
	from /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/inflector/methods.rb:284:in `constantize'
	from /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/core_ext/string/inflections.rb:74:in `constantize'
	from /usr/local/bundle/gems/doorkeeper-5.6.6/lib/doorkeeper/config.rb:442:in `access_grant_model'
	from /usr/local/bundle/gems/doorkeeper-5.6.6/lib/doorkeeper/orm/active_record.rb:40:in `initialize_configured_associations'
	from /usr/local/bundle/gems/doorkeeper-5.6.6/lib/doorkeeper/orm/active_record.rb:32:in `run_hooks'
	from /usr/local/bundle/gems/doorkeeper-5.6.6/lib/doorkeeper.rb:164:in `run_orm_hooks'
	from /usr/local/bundle/gems/doorkeeper-5.6.6/lib/doorkeeper/engine.rb:24:in `block in <class:Engine>'
	from /usr/local/bundle/gems/activesupport-6.1.4.4/lib/active_support/callbacks.rb:427:in `instance_exec'
       ...

System configuration

Doorkeeper version: 5.6.6
Ruby version: 3.0.4

@nbulaj
Copy link
Member

nbulaj commented May 3, 2023

hey @zedtux . How does your doorkeeper config looks like? It's weird that it tries to load AR if orm :mongoid configured

@zedtux
Copy link
Author

zedtux commented May 3, 2023

My ORM is rethinkdb, but that doesn't really matter I guess, and at that moment I don't have a doorkeeper.rb initialiser since I have just added the doorkeeper gem to my Gemfile, ran bundle and wanted to run rails generate doorkeeper:install like the documentation tells so.

@redross
Copy link

redross commented Mar 22, 2024

#1653 (comment)

Yup, same issue for me. Added gem - can't run the rake task. Maybe doing something wrong, but clearly something is not clear in the documentation if I'm not the only one stumbling on this.

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

No branches or pull requests

3 participants