Ruby on rails 生产中邮件程序中的Rails4模板错误
在我的生产环境中。我不断地发现这个错误:Ruby on rails 生产中邮件程序中的Rails4模板错误,ruby-on-rails,ruby-on-rails-4,actionmailer,production-environment,Ruby On Rails,Ruby On Rails 4,Actionmailer,Production Environment,在我的生产环境中。我不断地发现这个错误: ActionView::Template::Error: undefined method `protocol' for nil:NilClass 我不知道这个错误在我的模板中的什么地方,有人能帮我弄清楚吗 代码更新 完整代码: 我切断了,我认为可能引起问题的区域: <tr> <td class="eHeader" style=""> <table width="100%" border="0" c
ActionView::Template::Error: undefined method `protocol' for nil:NilClass
我不知道这个错误在我的模板中的什么地方,有人能帮我弄清楚吗
代码更新
完整代码:
我切断了,我认为可能引起问题的区域:
<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:support@crewnet.dk">support@crewnet.dk</a>.
<br>
<br>
Teamet bag CrewNet.dk
</p>
</td>
</tr>
</table>
</td>
<!-- end .eBody-->
</tr>
env
secrets.domain_name = crewnet.dk
可能是和url建设有关。您的production.rb中是否有
asset\u host
设置?也许您必须将协议添加到资产\u主机
Rails.application.configure do
...
config.action_mailer.asset_host = 'http://example.com'
...
end
请发布出现错误的相关代码。粘贴邮件程序和模板代码我发现问题确实出在操作\u mailer.asset\u主机上。我手动添加了主机名,而不是从env获取。我现在有一个问题,我的图片URL不是。
secrets.domain_name = crewnet.dk
Rails.application.configure do
...
config.action_mailer.asset_host = 'http://example.com'
...
end