umts / microservices-engine

Rails engine for attaching to our microservices and handling inter-service communication.
MIT License
0 stars 1 forks source link

Fix namespacing to not necessitate a special require statement #39

Open dfaulken opened 7 years ago

dfaulken commented 7 years ago

I couldn't figure out how to be able to use MicroservicesEngine.get in a model file.

dfaulken commented 7 years ago

Breaking this down a little more:

The gemspec pushes the lib directory onto the load path:

$LOAD_PATH.push File.expand_path('../lib', __FILE__)

And then in lib/microservices_engine.rb we declare module MicroservicesEngine.

So why then can I not write include MicroservicesEngine in a Rails model file?

dfaulken commented 7 years ago

@werebus deduced that this is a product of the fact that the gem is called umts-microservices-engine, but the Ruby file that needs to be required is named microservices_engine.rb.

You can write

gem 'umts-microservices-engine', require: 'microservices_engine'

but it'd be better if we didn't require people to do that.