jbox-web/ajax-datatables-rails

MongoDB Support

kcore opened this issue · 4 comments

kcore commented

Hi @n-rodriguez
I am willing to build the Mongoid support for ajax-datatables-rails. I followed #110 but seems like there have been drastic changes since 0.4.0 to the core library.
Do you have some best practices / get started doc on adding more ORM's? Would appreciate if you can point me in the right direction so that I can get this started?

Do you have some best practices / get started doc on adding more ORM's? Would appreciate if you can point me in the right direction so that I can get this started?

It's very "simple" : create a module named Mongoid in lib/ajax-datatables-rails/orm which responds to these methods :

  • filter_records
  • sort_records
  • paginate_records

See: https://github.com/jbox-web/ajax-datatables-rails/blob/master/lib/ajax-datatables-rails/orm/active_record.rb

kcore commented

Thanks. Let me check this and get back!

kcore commented

Hi @n-rodriguez, Sorry for the delay on this.
I had already tried doing this before reaching to your and it doesn't work - It throws an error
uninitialized constant AjaxDatatablesRails::Mongoid

I see a file https://github.com/jbox-web/ajax-datatables-rails/blob/master/lib/ajax-datatables-rails/active_record.rb - should I be adding a corresponding file for mongoid as well?

Also, I see the following line in base.rb -
class_attribute :db_adapter, default: ::ActiveRecord::Base.connection.adapter_name.downcase.to_sym
I believe I will have to do something to assign a corresponding mongo adapter...?

kcore commented

Hi @n-rodriguez apologies for following up so frequently and I totally understand you must be caught up with your work & appreciate your responses.
I really want to make this happen. is there anyone else that can guide me in the right direction?