File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ module Grape
6
6
# should subclass this class in order to build an API.
7
7
class API
8
8
# Class methods that we want to call on the API rather than on the API object
9
- NON_OVERRIDABLE = %I[ define_singleton_method instance_variable_set inspect class is_a? ! kind_of? respond_to? ] . freeze
9
+ NON_OVERRIDABLE = %I[ define_singleton_method instance_variable_set inspect class is_a? ! kind_of? respond_to? const_defined? const_missing ] . freeze
10
10
11
11
class << self
12
12
attr_accessor :base_instance , :instances
@@ -45,6 +45,15 @@ def api.inherited(child_api)
45
45
end
46
46
end
47
47
48
+ # Alleviates problems with autoloading by tring to search for the constant
49
+ def const_missing ( *args )
50
+ if base_instance . const_defined? ( *args )
51
+ base_instance . const_missing ( *args )
52
+ else
53
+ super
54
+ end
55
+ end
56
+
48
57
# The remountable class can have a configuration hash to provide some dynamic class-level variables.
49
58
# For instance, a descripcion could be done using: `desc configuration[:description]` if it may vary
50
59
# depending on where the endpoint is mounted. Use with care, if you find yourself using configuration
You can’t perform that action at this time.
0 commit comments