File tree Expand file tree Collapse file tree 4 files changed +22
-1
lines changed Expand file tree Collapse file tree 4 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 66
77#### Fixes
88
9+ * [ #1976 ] ( https://github.com/ruby-grape/grape/pull/1976 ) : Ensure classes/modules listed for autoload really exist - [ @dnesteryuk ] ( https://github.com/dnesteryuk ) .
910* [ #1971 ] ( https://github.com/ruby-grape/grape/pull/1971 ) : Fix BigDecimal coercion - [ @FlickStuart ] ( https://github.com/FlickStuart ) .
1011* [ #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 ) .
1112
Original file line number Diff line number Diff line change @@ -84,7 +84,6 @@ module Extensions
8484 eager_autoload do
8585 autoload :DeepMergeableHash
8686 autoload :DeepSymbolizeHash
87- autoload :DeepHashWithIndifferentAccess
8887 autoload :Hash
8988 end
9089 module ActiveSupport
Original file line number Diff line number Diff line change 1414 require file
1515end
1616
17+ eager_load!
18+
1719# The default value for this setting is true in a standard Rails app,
1820# so it should be set to true here as well to reflect that.
1921I18n . 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