Merge pull request #2656 from AndrewKvalheim/ajax-datatables-rails-293-postgresql

Fix bug in UserDatatable query affecting PostgreSQL
This commit is contained in:
James Mason 2020-06-19 19:07:18 -07:00 committed by GitHub
commit 754c47e41b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -47,12 +47,14 @@ class UserDatatable < AjaxDatatablesRails::Base
end
# rubocop:enable Naming/AccessorMethodName
# Workaround for jbox-web/ajax-datatables-rails#293
def records_total_count
fetch_records.unscope(:group).count(:all)
fetch_records.unscope(:group, :select).count(:all)
end
# Workaround for jbox-web/ajax-datatables-rails#293
def records_filtered_count
filter_records(fetch_records).unscope(:group).count(:all)
filter_records(fetch_records).unscope(:group, :select).count(:all)
end
# ==== These methods represent the basic operations to perform on records