Using a helper method in a mailer that is defined in a controller
- by Horace Loeb
The helper method current_user is defined and made available as a helper in ApplicationController like this:
class ApplicationController < ActionController::Base
helper_method :current_user
def current_user
return @current_user if defined?(@current_user)
@current_user = current_user_session && current_user_session.record
end
end
My question is how I can use the current_user helper method in a mailer template (obviously it will always return nil, but I'm trying to render a partial that depends on it).
Normally when I want to use helpers in a mailer, I do something like add_template_helper(SongsHelper), but since the helper is defined in a class instead of a module I'm not sure what to do