Getting "uninitialized constant" when trying to invoke my service in Rails
Asked Answered
A

1

4

I'm using Rails 4.2.3. I have this line in a controller:

service = XACTEService.new(“Event”, '2015-06-01', 'Zoo')

The class in question is defined in app/services/XACTEService.rb. However upon visiting my controller, I get the error:

uninitialized constant MyObjectsController::XACTEService

However, I have added this into my config/application.rb file

  class Application < Rails::Application
    config.autoload_paths += %W(#{config.root}/services)

So I don’t understand why the controller is failing to find my service.

Alexandria answered 31/5, 2016 at 13:40 Comment(0)
V
9

Rename this file:

app/services/XACTEService.rb

to:

app/services/xacte_service.rb
Vadnee answered 31/5, 2016 at 13:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.