mardi 17 mai 2016

Rails services globally available

I have a rails API, I want to use the services globally without require them in the controllers.

Print off the "#{config.root}" shows "/Users/sorry/Projects/Maestrano_Api/Api_test"

Structure Api_test ----> app -----> services ------> services.rb

In "config/application.rb" I have tried many things. config.autoload_paths += ["#{config.root}/app/services/sales_flow_service.rb"] config.autoload_paths += ["#{config.root}/app/services"]

with a different structure. Api_test ----> app -----> lib ------> services.rb and Api_test ----> app -----> lib ------> services ----> services.rb config.autoload_paths += ["#{config.root}/app/lib"] config.autoload_paths += ["#{config.root}/app/lib/services/services.rb"]

For some reason it does not work. What am I missing? Thanks in advance

Aucun commentaire:

Enregistrer un commentaire