jbox-web / ajax-datatables-rails

A wrapper around DataTable's ajax methods that allow synchronization with server-side pagination in a Rails app
MIT License
587 stars 228 forks source link

Version 1.3.0: uninitialized constant AjaxDatatablesRails::ActiveRecord::Base (NameError) #381

Closed klyonrad closed 3 years ago

klyonrad commented 3 years ago

After upgrading the gem to version 1.3.0 I receive the following error when the app is booted with eager loading off:

     7: /gems/ruby-2.6.6/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
     6: /ruby-2.6.6/gems/ajax-datatables-rails-1.3.0/lib/ajax-datatables-rails/base.rb:3:in `<main>'
     5: ruby-2.6.6/gems/ajax-datatables-rails-1.3.0/lib/ajax-datatables-rails/base.rb:4:in `<module:AjaxDatatablesRails>'
     4: ruby-2.6.6/gems/ajax-datatables-rails-1.3.0/lib/ajax-datatables-rails/base.rb:6:in `<class:Base>'
     3: ruby-2.6.6/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:59:in `load_missing_constant'
     2: ruby-2.6.6/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:80:in `rescue in load_missing_constant'
     1: gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:9:in `without_bootsnap_cache'
/Users/lukaludicke/.rvm/gems/ruby-2.6.6/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:80:in `block in load_missing_constant': uninitialized constant AjaxDatatablesRails::ActiveRecord::Base (NameError)

This happens with a rails app 6.0.x and classic eager loading and not zeitwerk. And, as you can see, bootsnap

(without eager loading it works by the way)

klyonrad commented 3 years ago

I can observe this error also when zeitwerk is enabled.

n-rodriguez commented 3 years ago

Can you please try with master branch?

klyonrad commented 3 years ago

That seems to do the trick. So I can also confirm that https://github.com/jbox-web/ajax-datatables-rails/pull/379 fixed this issue. We will wait for the next version then.

Thanks for the very quick reply!