will_paginate should clone query strings
Reported by rgiar | June 30th, 2008 @ 06:39 AM
to avoid regenerating a query string over and over, i reuse the same query. for example:
@@my_q = "select custom,other,and,another from cats where blah = 'blah'"
i then do:
Cat.paginate_by_sql(@@my_q, 1, 13)
and deep inside paginate_by_sql (lib/will_paginate/finder.rb:133) it does this:
add_limit! query, :offset => pager.offset, :limit => pager.per_page
which destructively changes the string. the .dup business in the lines above almost avoids modifying the input string, but barely misses.
Comments and changes to this ticket
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.
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!