thetron / mongoid_token

A little random, unique token generator for Mongoid documents.
MIT License
182 stars 91 forks source link

Mongoid 6 & 7 and rails 5.1, 5.2 & 6.0 upgrade #77

Open ritxi opened 7 years ago

ritxi commented 7 years ago
jclusso commented 3 years ago

@ritxi I'm using your master branch and I'm getting a zeitwerk error. NameError: uninitialized constant MongoidToken


$ bin/rails zeitwerk:check
Hold on, I am eager loading the application.
rails aborted!
NameError: uninitialized constant MongoidToken
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:392:in `const_get'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:392:in `block (2 levels) in eager_load'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:742:in `block in ls'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:734:in `foreach'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:734:in `ls'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:387:in `block in eager_load'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:376:in `synchronize'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:376:in `eager_load'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:494:in `each'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/zeitwerk-2.4.0/lib/zeitwerk/loader.rb:494:in `eager_load_all'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/railties-6.0.3.4/lib/rails/tasks/zeitwerk.rake:11:in `block in <main>'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/railties-6.0.3.4/lib/rails/tasks/zeitwerk.rake:47:in `block (2 levels) in <main>'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/railties-6.0.3.4/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/railties-6.0.3.4/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/railties-6.0.3.4/lib/rails/command.rb:48:in `invoke'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/railties-6.0.3.4/lib/rails/commands.rb:18:in `<main>'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `block in require'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:291:in `load_dependency'
/Users/jarrett/.rvm/gems/ruby-2.7.2@project/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:324:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => zeitwerk:check
(See full trace by running task with --trace)```
ritxi commented 3 years ago

What version of zeitwerk you use, may be newer versions have problems. Do you have more details to try to reproduce the error?

El dc., 28 d’oct. 2020, 22:05, Jarrett Lusso notifications@github.com va escriure:

@ritxi https://github.com/ritxi I'm using your master branch and I'm getting a zeitwerk error. NameError: uninitialized constant MongoidToken

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/thetron/mongoid_token/pull/77#issuecomment-718208362, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABDQ3GLMI67NJPGZK7EKBTSNCBSJANCNFSM4DVAE73Q .

jclusso commented 3 years ago

@ritxi I'm using zeitwerk (2.4.0) and rails (6.0.3.4). I can reproduce the error by just running the bin/rails zeitwerk:check.

jclusso commented 3 years ago

Not sure this is the best way to fix it, but this got the gem to load properly. I doubt this is the cleanest solution. https://github.com/jclusso/mongoid_token/commit/f1048a4073d754128af48f782e529c3a961d36e2