File tree 4 files changed +22
-1
lines changed
4 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 6
6
7
7
#### Fixes
8
8
9
+ * [ #1976 ] ( https://github.com/ruby-grape/grape/pull/1976 ) : Ensure classes/modules listed for autoload really exist - [ @dnesteryuk ] ( https://github.com/dnesteryuk ) .
9
10
* [ #1971 ] ( https://github.com/ruby-grape/grape/pull/1971 ) : Fix BigDecimal coercion - [ @FlickStuart ] ( https://github.com/FlickStuart ) .
10
11
* [ #1968 ] ( https://github.com/ruby-grape/grape/pull/1968 ) : Fix args forwarding in Grape::Middleware::Stack#merge_with for ruby 2.7.0 - [ @dm1try ] ( https://github.com/dm1try ) .
11
12
Original file line number Diff line number Diff line change @@ -84,7 +84,6 @@ module Extensions
84
84
eager_autoload do
85
85
autoload :DeepMergeableHash
86
86
autoload :DeepSymbolizeHash
87
- autoload :DeepHashWithIndifferentAccess
88
87
autoload :Hash
89
88
end
90
89
module ActiveSupport
Original file line number Diff line number Diff line change 14
14
require file
15
15
end
16
16
17
+ eager_load!
18
+
17
19
# The default value for this setting is true in a standard Rails app,
18
20
# so it should be set to true here as well to reflect that.
19
21
I18n . enforce_available_locales = true
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ # Grape uses autoload https://api.rubyonrails.org/classes/ActiveSupport/Autoload.html.
4
+ # When a class/module get added to the list, ActiveSupport doesn't check whether it really exists.
5
+ # This method loads all classes/modules defined via autoload to be sure only existing
6
+ # classes/modules were listed.
7
+ def eager_load! ( scope = Grape )
8
+ # get modules
9
+ scope . constants . each do |const_name |
10
+ const = scope . const_get ( const_name )
11
+
12
+ next unless const . respond_to? ( :eager_load! )
13
+
14
+ const . eager_load!
15
+
16
+ # check its modules, they might need to be loaded as well.
17
+ eager_load! ( const )
18
+ end
19
+ end
You can’t perform that action at this time.
0 commit comments