large dataset with no primary key, how do i group by efficiently?

14 views
Skip to first unread message

Dave

unread,
Jun 30, 2014, 11:15:34 PM6/30/14
to rubyonra...@googlegroups.com
I'm using Ransack and will_paginate on an Oracle view to fetch records to generate an array of hashes for DataTables.

@users = User.search(params[:q]).result.page(params[:page]).per_page(params[:per_page])

There's no primary key so my display currently looks like:

John | Doe | 123
-----------------------
John | Doe | 456
-----------------------
Jane | Doe | 123
-----------------------

Ideally, I'd like to be display it like this:


John | Doe | 123, 456
------------------------------
Jane | Doe | 123
------------------------------

I'm curious how people would go about doing this.

Can I use distinct on the Ransack result, paginate it to reduce my record set, do a left join on User to get the rows removed by distinct... and then what?
Reply all
Reply to author
Forward
0 new messages