Permalink
Browse files

Fixed bug with pagination param value where one could not pass in a v…

…alue other than what was obtained from the default parameter.
  • Loading branch information...
1 parent f5fa0b7 commit 4fdb039f61340f54a38f831638737b70942afc1c Brooke Kuhlmann committed Aug 23, 2011
Showing with 5 additions and 5 deletions.
  1. +4 −4 lib/resourcer/action_controller/instance_methods.rb
  2. +1 −1 lib/resourcer/version.rb
@@ -143,11 +143,11 @@ def build_resources
# * +relation+ - Required. The ActiveRecord::Relation to paginate.
# * +options+ - Optional. An options hash. Details below.
# ==== Options
- # * +:param+ - Optional. The pagination parameter name. Defaults to PAGINATION_PARAM.
- # * +:count+ - Optional. The pagination page count. Defaults to PAGINATION_COUNT.
+ # * +:number+ - Optional. The page number. Defaults to params[:PAGINATION_PARAM].
+ # * +:count+ - Optional. The page count. Defaults to PAGINATION_COUNT.
def paginate_relation relation, options = {}
- options.reverse_merge! :param => PAGINATION_PARAM, :count => PAGINATION_COUNT
- relation.respond_to?(:paginate) ? relation.paginate(options[:param] => params[options[:param]], :per_page => options[:count]) : relation
+ options.reverse_merge! :number => params[:PAGINATION_PARAM], :count => PAGINATION_COUNT
+ relation.respond_to?(:paginate) ? relation.paginate(:page => options[:number], :per_page => options[:count]) : relation
end
# Builds and authorizes the current resource via +authorize!+ method assumed to be provided via the CanCan[http://github.com/ryanb/cancan] gem.
@@ -1,3 +1,3 @@
module Resourcer
- VERSION = "2.1.6"
+ VERSION = "2.1.7"
end

0 comments on commit 4fdb039

Please sign in to comment.