Actually, this is my problem. I have a rails app with a MainController, a HttpHelper and a ServiceHelper.
main_controller.rb
class MainController < ApplicationController
include ServiceHelper
def my_method
Service.make_stuff
end
end
service_helper.rb
module ServiceHelper
class Service
include HttpHelper
def self.make_stuff
http__foo
end
end
end
Service = ServiceHelper::Service
http_helper.rb
module HttpHelper
def http__foo
#stuff
params[:bar].nil?
end
end
If everything work well, this code should tell me if the :bar param exist, but I have a problem. Firstly, this code doesn’t work, it tells me that http__foo is not defined, certainly because the include HttpHelper in Service doesn’t work.
My second probleme is that if the include works, there will probably be a problem with the params variable. If I call this method (http__foo) in the controller, it will be fine, but I call this from a subclass, then I’m not sure it’s be reliable.
make_stuffis a class method.http_foois an instance method. Hence, when you callhttp__foofrom yourmake_stuff, it is like callingService.http_foo()which is not defined. What is defined isService.new.http_foo().I don’t know what you want to do but in my humble opinion, by watching your code, it does not seem you are really familiar with
Rails MVC conceptand creating aMainController(why not useApplicationController?), as well as the way you use your helpers is weird to me. It might be a good idea to restart from scratch.