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
584 stars 228 forks source link

NameError: uninitialized constant AjaxDatatablesRails::ORM::ActiveRecord #421

Closed lay-z closed 3 months ago

lay-z commented 5 months ago

Using 1.4.0 with Rails 7.0.8, Ruby 3.2.3.

NameError: uninitialized constant AjaxDatatablesRails::ORM::ActiveRecord
from /home/layz/.rvm/gems/ruby-3.2.3/bundler/gems/ajax-datatables-rails-7ed2bcca0c75/lib/ajax-datatables-rails/active_record.rb:5:in `<class:ActiveRecord>'

When trying to initialize the Datable:

 ParcelDatatable.new(params)

Unclear to me why this would be happening. Have followed the docs to set up but cannot get ajax-datatables working right :pray:

EDIT:

Another thing that is very puzzling.

In the rails console, I am able to access AjaxDatatablesRails::ORM::ActiveRecord. However when I debug the index method where the DataTable is initialized, I find that AjaxDatatablesRails::ORM::ActiveRecord is uninitialized. not sure what i'm doing wrong.

Thank you for your hard work!

lay-z commented 3 months ago

Sorry, it turns out that this does work, as long as I don't go through the rails console. Closing this.