I am currently trying to use a Devise helper inside a service object
class ServiceObject
include Devise::Controllers::Helpers
But I get
undefined method `helper_method' for ServiceObject:Class
Any idea how to use such a helper inside the service object?
The problem is that
helper_methodis a method defined byActionController::Base. So including the module only works in subclasses of them.If the helper is already included in your
ApplicationControlleryou could simply useApplicationController.new.method_to_call