Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Updated paginate Helper for usage in Rails 3 #33

merged 2 commits into from

2 participants


I was having issues with the Paginate helper as is in Rails 3 where it was specifying the @template instance variable and should have been referencing controller instead. Perhaps it was a Rails 2-ism, but regardless, I've fixed that issue in the first commit. If it was that way for a reason, perhaps the following might be better:

template = @template || controller
uri = options[:uri] || template.url_for(template.params.merge(options[:params] || {}))

Otherwise, that change is good.

As well, I've updated the Helper to allow overriding of the uri used for pagination. I won't always want the controller.url_for when paginating.

@kyledrake kyledrake merged commit a9d4225 into tj:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/dm-pager/helpers/rails.rb
2  lib/dm-pager/helpers/rails.rb
@@ -10,7 +10,7 @@ module DataMapper::Pagination::Helpers::Rails
# :size Number of intermediate page number links to be shown; Defaults to 7
def paginate collection, options = {}
- uri = @template.url_for @template.params.merge(options[:params] || {})
+ uri = options[:uri] || controller.url_for(controller.params.merge(options[:params] || {}))
collection.pager.to_html uri, options
Something went wrong with that request. Please try again.