3

我需要能够禁用特定电子邮件的特定布局。我已经查看了Rails for ActionMailer - How to disable a Layout for a certain mailer但是我不知道在哪里以及如何输出必要的代码。我是 Ruby 新手,已经搜索了 API 文档,但找不到我需要的确切代码行。

4

2 回答 2

7
class YourMailer

  layout false, only: [:mail_method1, :mail_method2]

  def mail_method1
    #your code
  end
于 2012-12-28T18:46:41.550 回答
-1

您可以粗略地在 mail() 调用之前简单地执行此操作:

@_action_has_layout = false
于 2015-02-12T16:05:55.530 回答