生产中的邮件程序中的Rails4模板错误

狂犬病

在我的制作环境中 我不断收到此错误:

ActionView::Template::Error: undefined method `protocol' for nil:NilClass

我不知道此错误在模板中的位置,有人可以帮助我解决此问题吗?

代码更新

完整代码:Pastebin

我删掉了我认为可能引起问题的区域:

<tr>
      <td class="eHeader" style="">
      <table width="100%" border="0" cellpadding="0" cellspacing="0" style="">
          <tr>
              <td class="eHeader" style="">
                <table width="100%" border="0" cellpadding="0" cellspacing="0" style="">
                  <tr>
                    <td class="eHeaderLogo" style="">
                        <a href="#" style="">
                            <img class="imageFix" src="<%= image_url('crewnetlogo-white.png') %>" width="200" height="48" alt="Crewnet" style="">
                        </a>
                    </td>
                    <!-- end .eHeaderLogo-->
                    <td class="eHeaderOptions" style="">

                    </td>
                    <!-- end .eHeaderOptions--> 
                  </tr>
                </table>
                    </td>
            </tr>
        </table>
        </td>
    </tr>
    <tr>
      <td>
        <h1>
        <span>
            Du er blevet tildelt <%= @workplace.name %>
        </span>
        </h1>
          <div class="bannerLink">
            <a href="#" style="">
            <img src="<%= image_url "app.png" %>" alt="Crewnet" width="512" height="194" style="">
            </a>
          </div>
        </td>
        <!-- end .highlight--> 
      </tr>

    <tr>
      <td class="eBody bottomLine" style="">
      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="entryBox" style="">
          <tr>
            <td class="width132 pdBt16" style="">
            <a href="#" style="">
            <img src="<%= image_url "file_icon.gif" %>" width="116" height="116" alt="File" style="">
            </a>
            </td>
            <td class="alignLeft" style="">
              <p style=""> 
                Hej <%= @user.name %>!<br>
                Du har fået tildelt <%= @workplace.name %> som ansvarsområde. <br>
                For mere info log på <a href="<%= workplace_url(@workplace) %>">CrewNet | <%= @workplace.name %></a>.
              </p>
              <p style=""> 
                Skulle du have nogle spørgsmål, kan du kontakte supporten på <a href="mailto:[email protected]">[email protected]</a>.

                <br>
                <br>
                Teamet bag CrewNet.dk
              </p>
              </td>
          </tr>
        </table>
        </td>
      <!-- end .eBody--> 
    </tr>

邮件程序

class SupervisorMailer < ActionMailer::Base
  default from: "[email protected]"

    def assigned(user, workplace)
      @user = User.find(user)
      @workplace = Workplace.find(workplace)

      mail to: @user.email, subject: "Du er ansvarlig for #{@workplace.name}."
    end
end

production.rb

config.action_mailer.default_url_options = { :host => Rails.application.secrets.domain_name, :protocol => "http" }
config.action_mailer.asset_host =  Rails.application.secrets.domain_name

环保

secrets.domain_name = crewnet.dk
格吕克

可能是为了构建URL。asset_host您的production.rb中设置吗?也许您必须添加协议asset_host

Rails.application.configure do
  ...
  config.action_mailer.asset_host = 'http://example.com'
  ...
end

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Rails 4电子邮件在生产中的预览

Rails4:PDFKit模板丢失错误

生产中的 Rails JavaScript 错误:“赋值中的左侧无效”

Rails 4-无法通过动态错误页面在生产中呈现404(故障安全响应期间发生错误:缺少模板错误/显示)

生产中的Rails抛出502错误

Rails布线错误仅在生产中

在Rails 4+应用程序中,我已将应用程序部署到heroku,但静态图像未在生产中加载,但正在开发中

Rails4应用程序中实例变量的未定义方法错误

Rails 4-MissingTemplate / Missing部分错误,仅在生产中

无法使 javascripts 在生产中的 Rails 应用程序中工作

升级生产中的Rails

在Rails 4中无法通过image_tag在生产中投放的图像

Kaminari on rails4错误

尝试设置邮件程序时模板丢失错误-Rails

Rails项目在生产中显示开发样式错误

Rails自定义布局-生产中的路由错误

Rails 4.2 InvalidAuthenticityToken错误,但仅在生产中

生产中未调用错误处理程序

Rails 4:资产未在生产中加载

Rails 4-在生产中使用CDN

Rails 4 + Sass-生产中无背景图像

生产中的Rails 4子域(Nginx +乘客)

开发中的Rails POST(补丁)在生产中成为GET

如何在生产中将示例数据填充到我的 Rails 应用程序中?

Rails4生产elasticsearch错误-找不到geo_point,但是在Development中有效

Vue.js应用程序可在开发中工作,但无法在Rails 5.2.0 / Webpacker中的生产环境中安装模板-黑屏,控制台中无错误

Rails4,passenger,nginx(应用程序为rails4,但错误地检测为Rails1或Rails2)

Rails4 ActionController :: InvalidAuthenticityToken错误

部署到Heroku的Rails 5应用未在生产中发送sendgrid电子邮件