Replacing email/notification.html via custom Plugin - tips?

I’ve figured out what the issue was. The code for plugin.rb needs to be put inside after_initialize:

after_initialize do
    require_dependency 'user_notifications'
    module ::UserNotificationsOverride
        def send_notification_email(opts)
            Rails.configuration.paths["app/views"].unshift(File.expand_path("../templates", __FILE__))
            super(opts)
        end
    end

    class ::UserNotifications
        prepend ::UserNotificationsOverride
    end
end

That’s working fine now for me. Thanks for sharing this method!

2 Likes