Ruby on Rails Monday, June 30, 2014

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?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1f06e8b7-e134-463e-a11b-64dee7d2facc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment