Commit e68c75c 1 parent c427553 commit e68c75c Copy full SHA for e68c75c
File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -43,9 +43,12 @@ class Engine < Rails::Engine
43
43
Dir [ File . join ( File . dirname ( __FILE__ ) , '../tasks/*.rake' ) ] . each { |f | load f }
44
44
end
45
45
46
- # Check for required middlewares, can be missing in Rails API mode
46
+ # Check for required middlewares, users may forget to use them in Rails API mode
47
47
config . after_initialize do |app |
48
- has_session_store = app . config . middleware . to_a . any? { |m | m . klass . try ( :<= , ActionDispatch ::Session ::AbstractStore ) } || ::Rails . version < '5.0'
48
+ has_session_store = ::Rails . version < '5.0' || app . config . middleware . to_a . any? do |m |
49
+ m . klass . try ( :<= , ActionDispatch ::Session ::AbstractStore ) ||
50
+ m . klass . name =~ /^ActionDispatch::Session::/
51
+ end
49
52
loaded = app . config . middleware . to_a . map ( &:name )
50
53
required = %w( ActionDispatch::Cookies ActionDispatch::Flash Rack::MethodOverride )
51
54
missing = required - loaded
You can’t perform that action at this time.
0 commit comments