-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
NameError: uninitialized constant Doorkeeper::AccessToken on rake doorkeeper:db:cleanup #1319
Comments
Hi @j-arnaiz . Thanks for reporting it! It seems to be related to Rails auto/lazy-loading of AR models, which is (possibly) is not loaded yet on time when Rake task run. Try to add something like |
Hi @j-arnaiz . Any progress here? Did you try my suggestion above? |
Got the same issue when trying to modify
Adding |
@thisismydesign the problem is that ActiveRecord isn't loaded while running initializers, but you're trying to patch model that isn't loaded yet (Doorkeeper do a lazy load of models to respect custom AR options). Try to wrap your patch in a AR hook: ActiveSupport.on_load(:active_record) do
Doorkeeper::AccessToken.belongs_to :resource_owner, class_name: 'User'
end More info: https://api.rubyonrails.org/classes/ActiveSupport/LazyLoadHooks.html |
Thanks. From my side, this isn't an issue with doorkeeper then. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Rake tasks could be initializers when AR already loaded Fix #1319
So finally I found the issue! It's already loaded AR in time when rake tasks are loading. Fixed and would be released with next version of the gem |
Steps to reproduce
What we need to do to see your problem or bug?
On RakeFile:
Doorkeeper installed and configured with Rails 5.2.3
System configuration
Ruby 2.6.3 with mysql and ActiveRecord
Doorkeeper initializer:
Doorkeeper is working fine in endpoints and even on rails console. But rake cleanup task is not working.
Ruby version: ``
2.6.3
Gemfile.lock:
Gemfile.lock content
The text was updated successfully, but these errors were encountered: