On Oct 26, 10:25 am, Hussam Ali <[email protected]> wrote:
> Hi im trying to list random records on first page and from 2nd page to
> onwards, i need to show records by created_at using will_paginate plugin
> but i can only apply one of these condition at a time.
>
> Im showing based on order clause e,g
>
> Order('RAND()') or Order('created_at Desc')
>
> And then applying pagination on it. I don't know how to apply both of
> them with Random on ist page and created at on the rest of the
> pagination. Anybody have any idea?
>

That sounds like two mutually contradictory aims. You could perhaps
have a single 'random' page and then a series of paginated by
created_at pages.
If you absolutely had to present the illusion of the first page being
a random selection, you could also fiddle with the page parameter - if
it's 1 show a random selection, if it's greater than one subtract 1
and pass that to will_paginate

Fred
> --
> Posted viahttp://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to