Deduce page num from a model given a scope #328

Closed
rileytg opened this Issue Dec 21, 2012 · 1 comment

Comments

Projects
None yet
2 participants

rileytg commented Dec 21, 2012

Lets say I have the scope published on model Widget

def published 
    where(published: true).order('special_sort_order_int')
end

after a user creates a Widget I want to to take them to the page on index.html that has that model (this is assuming special_sort_order_int is calculated is some crazay way.

I'm thinking using a binary search algorithm might work, but then I'd want to cache that somehow to reduce the time on the next call (giving it at least a starting point could help no?).

Any thoughts?

cc/ @tlandismiller

This was referenced Jan 13, 2013

Owner

yuki24 commented Jun 29, 2013

To know which page the widget is on, please have a look at FAQ: https://github.com/amatsuda/kaminari/wiki/FAQ
it gives the idea of how to get the number of the page the record is on so we can redirect the user to the page.

yuki24 closed this Jun 29, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment