【问题标题】:Self-closing tags can't have content?自闭标签不能有内容?
【发布时间】:2012-12-31 05:19:11
【问题描述】:

我正在尝试为我的电子邮件使用邮件布局, 我已将 notifications_mailer.html.erb 放在 layouts 文件夹中,并且可以查看电子邮件 migration_message.html.haml

但是为什么我会有这个内部服务器错误 500:

自闭标签不能有内容

notifications_mailer.html.erb我有:

<div class="article-content" align="left" style="font-size: 13px;line-height: 18px;color: #444;margin-top: 0;margin-bottom: 18px;font-family: 'Helvetica Neue', Arial, Helvetica, Geneva, sans-serif">
   <%= yield %>
</div>   

这不是在邮件布局中添加产量的方式吗?

应该在哪里调试这个错误?在真实服务器上测试电子邮件之前,是否有一个 gem 可以在浏览器上测试电子邮件?

编辑

migration_message.html.haml 的代码

=content_for :title do
  Hello fan!
%p
  %span{:id => "internal-source-marker_0.12735640932997944"} We are happy to inform you about our new website, in which you can find new features. You have registered with us in our previous website, therefore we are very glad to inform you about our new one.
%p
  %span Take a look at the #{link_to 'Virtual Circuit Lab', lab_path} & check the Lab #{link_to 'Features', features_path}
  If you’ve already checked out the site, Follow our #{link_to 'Facebook page', "https://www.facebook.com/ourwebsite"} and invite a friend to do the same!
  %br/ 

【问题讨论】:

  • 你能把migration_message.html.haml的代码贴出来吗?

标签: ruby-on-rails-3 ruby-on-rails-3.2 haml mailer


【解决方案1】:

至于问题的第二部分,有一个名为 Letter Opener 的 gem 可以满足您的需求。当您在消息上调用deliver 时,它会打开带有消息的浏览器而不是发送消息。

【讨论】:

  • 谢谢,它似乎是一个有用的 gem,但是,当我尝试使用它时,我得到了这个错误:缺少要链接的主机!请提供 :host 参数,设置 default_url_options[:host],或设置 :only_path 为 true 您之前是否收到此错误?
  • 没有。尝试将此行输入config/environments/development.rb:config.action_mailer.default_url_options = { :host =&gt; 'localhost:3000' } 并重新启动应用程序。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-05-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-12-17
  • 2021-08-27
  • 1970-01-01
相关资源
最近更新 更多