通过自定义插件替换 email/notification.html - 有什么建议?

我已经找出问题所在。plugin.rb 的代码需要放在 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

现在对我来说运行正常。感谢分享这个方法!