0

背景资料

我正在通过Crafting Rails工作,在第 4 章中,我为“merb”模板制作了一个处理程序——穿插 erb 的降价。这可以编译成文本或 html,因此非常适合邮件。我的“new_submission”通知电子邮件在 app/views/notifications/new_submission.merb 中有一个模板。然后在 app/mailers/notifications.rb 中,你需要做的就是

mail(:to => Person.editor.email) do |format|
  format.text
  format.html
end

单个 .merb 模板被编译成多部分电子邮件的文本和 html 部分。呜呼!您可以在Crafting Rails 的摘录中阅读更多关于此的内容,也可以浏览我的具体实现

某处,不知何故,出了点问题

大约一周前我更新了我的 Gemfile,并认为我的一切正常,因为我的页面正在加载,Compass 和 Sass 不再对我发牢骚。由于某些可怕的原因,我没有进行任何测试。但事实证明,从那时起,每当我调用尝试发送此 new_submission 电子邮件的操作(例如“packlet.destroy”)时,我都会收到此错误:

ActionView::Template::Error (undefined method `children' for nil:NilClass):
  app/mailers/notifications.rb:25:in `block in new_submission'
  app/mailers/notifications.rb:23:in `new_submission'
  app/models/submission.rb:62:in `has_been'
  app/models/packlet.rb:20:in `destroy'
  app/controllers/packlets_controller.rb:27:in `destroy'

app/mailers/notifications 的第 26 行是“format.html”行,如上所示。

我通过更精细地执行此捆绑更新将其缩小到 haml/sass 3.1 的问题。我更新了 Rails,运行了我的测试,没有问题。我更新了haml,运行了我的测试,这会在四个地方弹出。

任何指导将不胜感激。

4

1 回答 1

3

这是 Haml 3.1 中的一个已知问题,由评论中的嵌套内容引起。(我从haml的创造者本人那里学到了这一点。)

于 2011-05-11T11:58:00.420 回答