Skip to content
This repository

add_limit! isn't being passed all options #111

Closed
wants to merge 1 commit into from

2 participants

Lucas Maxwell Mislav Marohnić
Lucas Maxwell
tism commented

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.

Lucas Maxwell 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 Marohnić
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 Marohnić mislav closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Mar 16, 2011
Lucas Maxwell 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
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. +1 1  lib/will_paginate/finder.rb
2  lib/will_paginate/finder.rb
@@ -133,7 +133,7 @@ def paginate_by_sql(sql, options)
133 133 query = sanitize_sql(sql.dup)
134 134 original_query = query.dup
135 135 # add limit, offset
136   - add_limit! query, :offset => pager.offset, :limit => pager.per_page
  136 + add_limit! query, options.merge(:offset => pager.offset, :limit => pager.per_page)
137 137 # perfom the find
138 138 pager.replace find_by_sql(query)
139 139

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.