Forum: Ruby on Rails pagination problem using will_paginate with two models

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E38118c6d20b4544e424fd700571e090?d=identicon&s=25 srikanth (Guest)
on 2009-02-05 05:25
(Received via mailing list)
Hi,

let me explain my application details:

I have two controllers:
1.streams_controller
2.search_controller

And i have two models:
1.stream.rb
2.search.rb

in streams_controller, i am uploading and downloading streams
in search controller i am searching the streams from database.

Here i have used will_paginate plugin for pagination in streams
controller.It is working fine.
to make it work i  have added below code :

in controller:
@streams = Stream.paginate(:page => params[:index],:per_page => 2)

in view page:
<%= will_paginate(@streams, :param_name => 'index') -%>

But in search controller if i use pagination its not happening .Simply
it is showing the page number on display page .

i  have added below code :
in controller:
@test2 = Stream.paginate(:page => params[:get_results],:per_page => 2)
in view page:
<%= will_paginate(@test2, :param_name => 'get_results') -%>

here i am using same model 'stream'  and collecting in test2.
what could be the problem?
Can any one suggest me to make it work?

thanks
Srikanth
This topic is locked and can not be replied to.