Skip to content

Commit

Permalink
Merge pull request #24 from mmclead/master
Browse files Browse the repository at this point in the history
support for Grape 0.10 with refactored settings
  • Loading branch information
davidcelis committed Jan 13, 2015
2 parents 2a546ed + 34879e8 commit 10e4fbc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.bundle
.config
.yardoc
.ruby-version
Gemfile.lock
InstalledFiles
_yardoc
Expand Down
2 changes: 1 addition & 1 deletion api-pagination.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Gem::Specification.new do |s|
s.require_paths = ['lib']

s.add_development_dependency 'rspec', '~> 3.0'
s.add_development_dependency 'grape'
s.add_development_dependency 'grape', '>= 0.10.0'
s.add_development_dependency 'railties', '>= 3.0.0'
s.add_development_dependency 'actionpack', '>= 3.0.0'
s.add_development_dependency 'sequel', '>= 4.9.0'
Expand Down
4 changes: 2 additions & 2 deletions lib/grape/pagination.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def self.included(base)
def paginate(collection)
options = {
:page => params[:page],
:per_page => (params[:per_page] || settings[:per_page])
:per_page => (params[:per_page] || route_setting(:per_page))
}
collection = ApiPagination.paginate(collection, options)

Expand All @@ -28,7 +28,7 @@ def paginate(collection)

base.class_eval do
def self.paginate(options = {})
set :per_page, (options[:per_page] || 25)
route_setting :per_page, (options[:per_page] || 25)
params do
optional :page, :type => Integer, :default => 1,
:desc => 'Page of results to fetch.'
Expand Down

0 comments on commit 10e4fbc

Please sign in to comment.