Rails 4.2 - Created a "services" directory for the PORO helpers, but the console / controllers etc. Doesn't see him
I have some logic that will manipulate the data before starting the job queue. However, inside the controller as well as in the rails console, I cannot access the classes. Example:
As app/services/hobo_service.rb
I have
class HoboService
def initialize
@api = Hobos::Api.new
end
def run
hobo
end
private
attr_reader :api
def hobo
api.hobo
end
end
However, if in my relevant controller I put
...
def create
@name = HoboService.new.run
end
...
Throws an exception saying the object could not be found.
It seems like everything in the directory app
should be in a pipeline and accessible. What am I missing here? Since then, until recently, there hasn't been with Rails.
+3
source to share