# Problem with will\_paginate

**URL:** <https://www.ruby-forum.com/t/problem-with-will-paginate/156249>\
**Category:** Rails\
**Created:** [December 23, 2008, 1:25pm UTC](https://www.ruby-forum.com/t/problem-with-will-paginate/156249 "2008-12-23T13:25:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![nihil\_chauhan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/838e76/32.png) [@nihil\_chauhan](https://www.ruby-forum.com/u/nihil_chauhan)\
**Post date:** [December 23, 2008, 1:25pm UTC](https://www.ruby-forum.com/t/problem-with-will-paginate/156249/1 "2008-12-23T13:25:06Z")

</div>

hiii all

i am new to ruby on rails. i am facing a problem with pagination. i have  
a page  
on which i have three partial and all have pagination. if i click on one  
partial’s next page it will update all the three partial to second page.  
Please help me to solve this problem.

---

<div class="post-metadata">

**Author:** ![nihil\_chauhan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/838e76/32.png) [@nihil\_chauhan](https://www.ruby-forum.com/u/nihil_chauhan)\
**Post date:** [December 23, 2008, 1:56pm UTC](https://www.ruby-forum.com/t/problem-with-will-paginate/156249/2 "2008-12-23T13:56:31Z")

</div>

one way would be to only update one of your partials using ajax.

another way would be to post your code here…

---

<div class="post-metadata">

**Author:** ![nihil\_chauhan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/838e76/32.png) [@nihil\_chauhan](https://www.ruby-forum.com/u/nihil_chauhan)\
**Post date:** [December 23, 2008, 2:03pm UTC](https://www.ruby-forum.com/t/problem-with-will-paginate/156249/3 "2008-12-23T14:03:17Z")

</div>

MaD wrote:

> one way would be to only update one of your partials using ajax.
> 
> another way would be to post your code here…

I m using ajax pagination.

---

<div class="post-metadata">

**Author:** ![nihil\_chauhan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/838e76/32.png) [@nihil\_chauhan](https://www.ruby-forum.com/u/nihil_chauhan)\
**Post date:** [December 23, 2008, 2:07pm UTC](https://www.ruby-forum.com/t/problem-with-will-paginate/156249/4 "2008-12-23T14:07:04Z")

</div>

well then there has to be some error in your code. look at your  
targets. you have to specify the correct div/container to update. that  
way only one of your partials will turn to the next page.

On 23 Dez., 14:03, Nihil C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![nihil\_chauhan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/838e76/32.png) [@nihil\_chauhan](https://www.ruby-forum.com/u/nihil_chauhan)\
**Post date:** [December 23, 2008, 2:29pm UTC](https://www.ruby-forum.com/t/problem-with-will-paginate/156249/5 "2008-12-23T14:29:56Z")

</div>

i don’t think this will work. why don’t you just specify which div to  
update, depending on which pagination has been clicked (on the client  
side) and make your call accordingly?

---

<div class="post-metadata">

**Author:** ![nihil\_chauhan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/838e76/32.png) [@nihil\_chauhan](https://www.ruby-forum.com/u/nihil_chauhan)\
**Post date:** [December 23, 2008, 2:10pm UTC](https://www.ruby-forum.com/t/problem-with-will-paginate/156249/6 "2008-12-23T14:10:30Z")

</div>

\<%= will\_paginate  
@category\_history,:renderer=\>‘RemoteLinkRenderer’,:remote=\>{:with=\>‘value’,:update=\>‘category\_history’}%\>

i want to send an id with this will\_paginate which i can get in  
controller and check for which one div i have to update.

---

<div class="post-metadata">

**Author:** ![nihil\_chauhan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/838e76/32.png) [@nihil\_chauhan](https://www.ruby-forum.com/u/nihil_chauhan)\
**Post date:** [January 17, 2009, 9:00am UTC](https://www.ruby-forum.com/t/problem-with-will-paginate/156249/7 "2009-01-17T09:00:41Z")

</div>

MaD wrote:

> \<%= will\_paginate  
> @category\_history,:renderer=\>‘RemoteLinkRenderer’,:remote=\>\>{:with=\>‘value’,:update=\>‘category\_history’}%\>  
> i don’t think this will work. why don’t you just specify which div to  
> update, depending on which pagination has been clicked (on the client  
> side) and make your call accordingly?

I have faced the same type of problem.  
\<%= will\_paginate  
@posts,:renderer=\>‘RemoteLinkRenderer’,:remote=\>\>{:with=\>‘value1’,:update=\>‘postsDivId’}%\>

in the the Post list is in the postDivId div.  
But it will show the whole page in the div when I click the next page  
link.  
I have tried with partial with when I use the code  
in index.html.erb

 \<%= render :partial =\> 'contents' %\>

Partial view: \_contents.html.erb  
\<%= will\_paginate @collection, :renderer =\> ‘RemoteLinkRenderer’,  
:remote =\> {:update =\> ‘container’} %\>

in controller the index action :  
respond\_to do |format|  
format.html { render :partial =\> ‘container’ }  
format.xml { render :xml =\> @posts }  
end

It just show only the partial not the total page with the partial  
display.

Please help me
