#119 ✓resolved
Matt Aimonetti (mattetti)


Reported by Matt Aimonetti (mattetti) | September 26th, 2007 @ 10:10 PM

So here is my problem, I'm using will_paginate to paginate a list a pictures. The pagination helper is located at the bottom of the panel with all my pictures.

In the in the same page I have an ajax picture editor.

When a picture is edited (update call), the panel with all the questions is reloaded(rjs).

The issue is that I call the helper every time the photo panel is reloaded. Since the helper uses the action params to create the link, my pagination links are all messed up.

I believe that the links should only merge the GET parameters and not the POST and especially not the UPDATE and DELETE params.

What do you think?


Comments and changes to this ticket

  • Matt Aimonetti (mattetti)

    Matt Aimonetti (mattetti) September 26th, 2007 @ 10:18 PM

    on suggestion to fix this problem is to add a new pagination option: pagination_action or default_action.

    in the page_link_or_span method we can easily check on request.method, if we don't get a :get request and we have a pagination_action defined, we can merge the params with the pagination_action and the page info to create a proper link.

  • Matt Aimonetti (mattetti)
  • Mislav

    Mislav September 26th, 2007 @ 10:38 PM

    • State changed from “new” to “open”

    Not so simple. The helper must merge GET or POST params because the page being rendered might be a search initiated by GET or POST and I have to preserve params of the search between pages.

    Can you explain better what you're doing? I didn't understand nothing about updates, panels, questions or ajax reloading. Thanks

  • Matt Aimonetti (mattetti)

    Matt Aimonetti (mattetti) September 26th, 2007 @ 10:57 PM

    I have some update and delete action called remotely which re render a div including some photos and the pagination helper.

    The pagination helper is included in the div because it needs to be refreshed in case some photos were removed.

    The ajax calls are using the UPDATE or DELETE methods to update or delete one or many pictures. The actions called by these remote forms have nothing to do with the action handling the pagination, however since you are merging the request params, the pagination tries to call the same action again.

    I can't find a case where it would make sense for the pagination helper to make an update/delete call to any action.

    Does it make more sense?


  • Mislav

    Mislav October 5th, 2007 @ 06:09 PM

    Fjan, I don't think I'll be supporting that practice, but will definitely make this configurable. You will be able to mess with merged parameters as much as you want

  • Mislav

    Mislav December 25th, 2007 @ 01:36 AM

    • State changed from “open” to “resolved”

    Hey Matt, Fjan,

    In changeset [422] I've stopped preserving parameters in pagination links for non-GET requests. So, obviously I listened to Matt's suggestion.

    You can tamper with parameters, though:

    will_paginate @posts, :params => { :foo => 'bar' }

    In this example, all page links will have the "foo" parameter. Similarly, with nil values you can prevent certain keys from showing up in page links.

  • Dan

    Dan February 19th, 2008 @ 11:48 PM

    so does that mean that the only way to generate links for the results of a post based search is to manually tell the will_paginate helper the url parameters for the generated links?

    i.e will_paginate @collection, :params => {:controller => 'foo', :action => 'bar'}

  • Mislav

    Mislav February 23rd, 2008 @ 01:41 PM

    Dan: yes, and you shouldn't have POST searches anyway.

  • ardthurxen (at gmail)

    ardthurxen (at gmail) June 18th, 2016 @ 12:49 PM

    • Title changed from “helper issue when request.method != :get” to “YYdscvafZTgajkdfv”

    Gtczxvdg http://fxfskrddfbxdf.com
    here: Gtczxvdg http://fxfskrddfbxdf.com
    best Gtczxvdg http://fxfskrddfbxdf.com
    dfsdgbcdsHLBHFDasufksdfjln Maefegvtjy
    Ozxcjkl Maefegvtjy dfdfdfdsdgd

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Everyone's favorite Ruby library for pagination of practically anything!

People watching this ticket


Referenced by