Frederick Cheung wrote in post #1028581:
> On Oct 26, 10:25am, Hussam Ali <[email protected]> wrote:
>> 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


Ok i got your point, i have done this and it works,

if params[:page].to_i > 1
 order by created_at
else
 order by random
end

Is there any other possible approach of handling it or how can i make
the above code more efficient??????

-- 
Posted via http://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