Skip to content

Datatables paging when ActiveRecord query uses .group #356

Open
@toomanyjoes

Description

@toomanyjoes

If the activerecord query that feeds the datatable uses group it totally breaks paging. I assume this is because .count is being called on the result set at some point when creating page elements and for a group by query .count returns a hash not a number.

My work around was to make another query in get_raw_records that uses a subquery on the model I'm querying to pluck the elements by their ids from the first query. Since this query is just a .where .count returns a number and it works. But it seems like this could be an easy fix if when using .count the code first checked for a hash before assuming it was returning a number.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions