grape icon indicating copy to clipboard operation
grape copied to clipboard

Autoloading dependencies with Grape as a stand-alone API?

Open ggwc82 opened this issue 7 years ago • 3 comments

All my search efforts and reading of the documentation for Grape seems to indicate that autoloading is a feature provided when Grape is used in combination with another framework, such as Sinatra or Rails. I'm using Grape API as a stand alone application, and with many modules and classes I'm finding I have to explicitly define require_relatives throughout my app.

My question is, does Grape provide an autoloader similar to this out of the box?

ggwc82 avatar Dec 06 '18 10:12 ggwc82

AFAIK Grape does not, but this could be a good development opportunity, I'll label this as a feature

dblock avatar Dec 06 '18 19:12 dblock

Grape already depends on ActiveSupport, so maybe it can be used for this.

require 'active_support/dependencies'
ActiveSupport::Dependencies.autoload_paths = [
  'app'
]

dm1try avatar Dec 13 '18 16:12 dm1try