File tree Expand file tree Collapse file tree 3 files changed +21
-5
lines changed
Expand file tree Collapse file tree 3 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ Gem::Specification.new do |s|
1818
1919 s . add_development_dependency 'rspec' , '~> 3.0'
2020 s . add_development_dependency 'grape' , '>= 0.10.0'
21- s . add_development_dependency 'railties' , '>= 3 .0.0'
22- s . add_development_dependency 'actionpack' , '>= 3 .0.0'
21+ s . add_development_dependency 'railties' , '>= 5 .0.0'
22+ s . add_development_dependency 'actionpack' , '>= 5 .0.0'
2323 s . add_development_dependency 'sequel' , '>= 4.9.0'
2424end
Original file line number Diff line number Diff line change 1717 WARNING
1818end
1919
20- require 'api-pagination/railtie' if defined? ( Rails )
20+ if defined? ( Rails )
21+ module ApiPagination
22+ module Hooks
23+ def self . rails_parent_controller
24+ if Rails ::VERSION ::MAJOR >= 5 || defined? ( ActionController ::API )
25+ ActionController ::API
26+ else
27+ ActionController ::Base
28+ end
29+ end
30+ end
31+ end
32+
33+ require 'api-pagination/railtie'
34+ end
Original file line number Diff line number Diff line change 1- require 'action_controller'
1+ require 'action_controller/railtie '
22require 'api-pagination/hooks'
33require 'ostruct'
44
@@ -59,7 +59,7 @@ def to_json(options = {})
5959 end
6060end
6161
62- class NumbersController < ApiPagination :: Hooks . rails_parent_controller
62+ class NumbersController < ActionController :: API
6363 include Rails . application . routes . url_helpers
6464
6565 def index
@@ -99,3 +99,5 @@ def index_with_paginate_array_options
9999 render json : NumbersSerializer . new ( numbers )
100100 end
101101end
102+
103+ ApiPagination ::Railtie . initializers . each ( &:run )
You can’t perform that action at this time.
0 commit comments