ruby - Rails 4.2 - Made a 'services' directory for PORO helpers but console/controllers etc don't see it -
i have logic going manipulate data before starting job queue. however, inside controller , in rails console cannot seem access classes. example:
in app/services/hobo_service.rb
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 relevent controller put
... def create @name = hoboservice.new.run end ...
raises exception saying object cannot found.
it seems if in app
directory should in pipeline , available. missing here? haven't been on rails since 3.2 until recently.
i'm not sure why subdirectory of app ignored, let's try simple solution- happens when add application class in application.rb?
config.autoload_paths += %w(#{config.root}/app/services)
Comments
Post a Comment