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|
18
18
19
19
s . add_development_dependency 'rspec' , '~> 3.0'
20
20
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'
23
23
s . add_development_dependency 'sequel' , '>= 4.9.0'
24
24
end
Original file line number Diff line number Diff line change 17
17
WARNING
18
18
end
19
19
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 '
2
2
require 'api-pagination/hooks'
3
3
require 'ostruct'
4
4
@@ -59,7 +59,7 @@ def to_json(options = {})
59
59
end
60
60
end
61
61
62
- class NumbersController < ApiPagination :: Hooks . rails_parent_controller
62
+ class NumbersController < ActionController :: API
63
63
include Rails . application . routes . url_helpers
64
64
65
65
def index
@@ -99,3 +99,5 @@ def index_with_paginate_array_options
99
99
render json : NumbersSerializer . new ( numbers )
100
100
end
101
101
end
102
+
103
+ ApiPagination ::Railtie . initializers . each ( &:run )
You can’t perform that action at this time.
0 commit comments