Skip to content
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

MongoDB Support #390

Open
kcore opened this issue May 4, 2021 · 4 comments
Open

MongoDB Support #390

kcore opened this issue May 4, 2021 · 4 comments

Comments

@kcore
Copy link

kcore commented May 4, 2021

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?

@n-rodriguez
Copy link
Member

n-rodriguez commented May 5, 2021

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
Copy link
Author

kcore commented May 5, 2021

Thanks. Let me check this and get back!

@kcore
Copy link
Author

kcore commented May 6, 2021

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
Copy link
Author

kcore commented May 10, 2021

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?

@kcore kcore changed the title Mongoid Support MongoDB Support May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants