Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using will_paginate with multiple models (Rails)

Tags:

Pretty sure that I'm missing something really simple here:

I'm trying to display a series of pages that contain instances of two different models - Profiles and Groups. I need them ordering by their name attribute. I could select all of the instances for each model, then sort and paginate them, but this feels sloppy and inefficient.

I'm using mislav-will_paginate, and was wondering if there is any better way of achieving this? Something like:

[Profile, Group].paginate(...)

would be ideal!