Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

add_limit! isn't being passed all options #111

Closed
wants to merge 1 commit into from

2 participants

@tism

When using paginate_by_sql the passed in options hash isn't entirely passed on to the connection adapter, only the offset and limit are. To keep things in line with other find methods that take options hashes I've merged the pagers offset/limit back into the options hash and passed it on.

This isn't really a bug in will_paginate it's more a cleaner way of getting more information down to the sql server connection adapter.

@tism tism Merge the offset and limit back into the passed in options so the con…
…nection adapater can see all of the options

This is mostly done to support the sqlserver adapter that looks for the order hash member to support limit and offset
adea61b
@mislav
Owner

Thanks, but if it isn't necessary, I don't feel the need to add it. It works the way it is now.

@mislav mislav closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 16, 2011
  1. @tism

    Merge the offset and limit back into the passed in options so the con…

    tism authored
    …nection adapater can see all of the options
    
    This is mostly done to support the sqlserver adapter that looks for the order hash member to support limit and offset
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/will_paginate/finder.rb
View
2  lib/will_paginate/finder.rb
@@ -133,7 +133,7 @@ def paginate_by_sql(sql, options)
query = sanitize_sql(sql.dup)
original_query = query.dup
# add limit, offset
- add_limit! query, :offset => pager.offset, :limit => pager.per_page
+ add_limit! query, options.merge(:offset => pager.offset, :limit => pager.per_page)
# perfom the find
pager.replace find_by_sql(query)
Something went wrong with that request. Please try again.