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_method
is a method defined byActionController::Base
. So including the module only works in subclasses of them.If the helper is already included in your
ApplicationController
you could simply useApplicationController.new.method_to_call